sql 同时查询2个表中字段值是否相等

2025-02-23 05:23:01
推荐回答(6个)
回答1:

select bm from a
union
select sfzbm from b
minus
(select bm from a,b where a.bm=b.sfzbm);

回答2:

用表链接

回答3:

select * from A where bm not in (select bm from B)

回答4:

两张表都有姓名吗?

回答5:

select dm from A except(select sfzbm from B)

回答6:

select bm from A where bm not in (select sfzbm from B)
union all
select sfzbm from B where sfzbm not in (select bm from A)