有两张表table0(T001,T002,VALUE) table1(W001,W002,VALUE)
table0与table2通过T001=W001和T002=W002进行关联;
我现在想找到table0中的不存在于table1中的记录,请问这条SQL语句怎么写??
table0与table2通过T001=W001和T002=W002进行关联;
我现在想找到table0中的不存在于table1中的记录,请问这条SQL语句怎么写??
FROM table0 AS A
WHERE NOT EXISTS(
SELECT *
FROM table1
WHERE A.T001=W001
AND A.T002=W002
)
2、except
from tb0 left join tb1 on tb0.T001=tb1.W001 and tb0.T002=tb1.W002
where tb2.woo is null
select m.* from table0 m where not exists (select 1 from table1 n where w001 = m.T001 and w002 = m.T002)
select a.* from table0 a
where not exists(
select * from table1 where a.T001=W001 and a.T002=W002)
from table1 as a right join table0 as b on T001=W001 and T002=W002
select * from table0 where checksum(t001 , t002) not in (select checksum(w001 , w002) from table1)
FROM table0 AS T0
LEFT OUTER JOIN table1 AS T1
ON T0.T001 = T1.W001 AND T0.T002 = T1.W002
WHERE T1.W001 IS NULL AND T1.W002 IS NULL
select b.*
from table1 as a right join table0 as b on T001=W001 and T002=W002
where W001 is null
where not exists(select 1 from table1 where t.T001=W001 and t.T002=W002)
2.也可以用full join 再判断null