首页 新闻 会员 周边

怎么做数据对比,比对出异常数据

0
[已解决问题] 解决于 2017-12-05 22:26

我想查询A表的name字段,在B表中是否有一样的数据,两个表字段大致一样都

sql
如梦一场的主页 如梦一场 | 菜鸟二级 | 园豆:234
提问于:2017-12-05 13:54
< >
分享
最佳答案
0

A 表中有,b表中没有的  :  select * from A left join B on A.name = B.name where B.name is null 

B 表中有,A表中没有 : select * from B left join A on A.name = B.name where A.name is null 

奖励园豆:5
百鸟朝凤 | 菜鸟二级 |园豆:260 | 2017-12-05 17:24
select (case when q.uniscid=o.uniscid then q.uniscid else null end)as uniscid,
(case when q.regno=o.regno then q.regno else null end)as regno ,
(case when q.entname=o.entname then q.entname else null end)as entname from data_syfr_tem o ,data_qyfr q where o.entname=q.entname or o.uniscid=q.uniscid or o.regno=q.regno ;

我是这样写的,也能实现,不知道和你的哪个快点。。

如梦一场 | 园豆:234 (菜鸟二级) | 2017-12-05 18:01
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册