sql语句查询A表有而B表没有的数据?

2024-11-07 00:11:32
推荐回答(1个)
回答1:

SELECT A.户名
FROM TABLE_A A, TABLE_B B
WHERE A.户名 = B.户名(+)
WHERE B.户名 IS NULL

还可以有其他方法:1 select distinct A.ID from  A where A.ID not in (select ID from B)

1 select A.ID from A left join B on A.ID=B.ID where B.ID is null