表A, a.id 表B,b.id
其中a.id与b.id字段值部分相等.
现求, a.id=b.id 不相等a表中的值(意思a表中字段a.id在B表中字段b.id,中不相等的那些值,(不显示a.id=b.id的所有值,而显示a.id!=b.id的所有值))
求SQL语法!
其中a.id与b.id字段值部分相等.
现求, a.id=b.id 不相等a表中的值(意思a表中字段a.id在B表中字段b.id,中不相等的那些值,(不显示a.id=b.id的所有值,而显示a.id!=b.id的所有值))
求SQL语法!
from a
where not exists(select 1
from b
where a.id=b.id)
from a
where a.id not in (select id
from b)
where not exists (select 1 from b where a.id=b.id);select a.* from a where a.id not in(select b.id from b);兩個都行,如果B表中資料較多,用exists.