一个看似简单的SELECT,可惜我写不来.立刻结贴
--A表
iddate TEMP
a012013-04-05fda
a022013-04-05dsfdsaf
a012013-04-06fdsafdasfd
a022013-04-06fdsafdasfd
--B表
iddate temp
a012013-04-05aaa
a022013-04-05bbb
a012013-04-06ccc
---------------------------------
求A表存在,但B表不存在的数据,判断(ID,date) 2个字段.
即找到以下这条结果.
a022013-04-06
[解决办法]
select * from A left join B on a.id=b.id and a.date=b.date where b.id is null
[解决办法]
select * from A where not exists(select 1 from B where id=A.id and data=A.data)
SELECT A.id,A.date
FROM A
WHERE NOT EXISTS(SELECT 1 FROM B WHERE A.id = b.id AND a.[date] = b.[date])