各位大虾请帮忙,在线等待!!!!!!!

俺是一个菜鸟,有一个句子不会写了请大家帮忙!

有一个表A里有1 2 3 4 5 6 7 8 9
有一个表B里有1 3 5 7

用一个句子将近A表里的2 4 6 8 9取出,其实B是A的一个子集要求用一个句子把A中不属于B的数据取出!!!

在这先谢了!!!(急)
---------------------------------------------------------------

select id from a where id not in (select id from b)

斑竹加的:
如果数据量大,下面语句效率高些:
select id from a
where not exists (
select id from b where b.id=a.id
)

Published At
Categories with 数据库类
Tagged with
comments powered by Disqus