如何返回表中找不到的ID [英] How to return the ids that not where found in a table

查看:62
本文介绍了如何返回表中找不到的ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好.

我需要一个查询,在该查询中,我想举例说明在表中找不到的ID,例如

拥有表格收件箱
ID |名称|
---------------------
1 |杜德
2 |其他花花公子
3 |一些花花公子
4 |那家伙

如果我搜索ID 1,3,6,7,10,我希望查询返回6,7和10

有可能吗?查询将如何?

谢谢

Hello.

I need a query where i will want to egt the ids that not where found in a table for example

Having a table Inbox
Id | Name |
---------------------
1 | Dude
2 | Other Dude
3 | Some Dude
4 | That Dude

if i search for Ids 1,3,6,7,10 i will like my query to return 6,7 and 10

is it possible?, how would the query be?

Thanks

推荐答案

在此示例中,如何将1,3,6,7,10传递给查询?

您需要将这些值放入单独的表或某种虚拟函数驱动的表中.然后是这样的:

How are you passing in 1,3,6,7,10 to your query in this example?

You need to get those values into a seperate table, or some sort of virtual function driven table. Then its something like:

select id from <new table> where id not in (select id from <existing table>)


这篇关于如何返回表中找不到的ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆