我如何在MySQL中做这样的事情?
(1274649,682844,872502,1016256)
INTERSECT
(SELECT id FROM `users` WHERE `id` IN (1274649,682844,872502,1016256))根据评论意见作如下修改:
这四个数字是我现在的ID。我想知道哪些in在我的表中没有条目,其中有多少没有条目?
发布于 2012-05-10 06:27:29
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这将返回那些在id表中没有对应id的users。
添加了,这是对注释:Which entries in my list do not have an entry in my table?中OP解释的回答
https://stackoverflow.com/questions/10527940
复制相似问题