如何在 MySQL 中执行类似的操作?
(1274649,682844,872502,1016256)
INTERSECT
(SELECT id FROM `users` WHERE `id` IN (1274649,682844,872502,1016256))
<小时/>
改编自评论:
These four numbers are the IDs that I have now. I want to know which of these IDs do not have an an entry in my table, and how many of them don't have an entry?
最佳答案
select t.id from (
select 1274649 as id union
select 682844 union
select 872502 union
select 1016256
) t
left join users u on u.id = t.id
where u.id is null
这将返回那些在 users
表中没有对应 id
的 id
。
添加这是评论中OP解释的答案:Which entries in my list do not have an entry in my table?
关于mysql - 我的列表中的哪些条目在我的表中没有条目?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10527940/