有两个select语句 ,我想把它们结合起来并去重请教
select *from reportA where reportA.网元名称 not in (select reportB.网元名称 from reportB)
结果
a1 NULL NULL NULL NULL NULL NULL
a2 NULL NULL NULL NULL NULL NULL
另一个
select * from reportA where checksum(*) not in (select checksum(*) from reportB)
结果
3001-江南 GE 0 0 0 0 0
3016-江北4 E3/T3 0 0 0 0 0
a1 NULL NULL NULL NULL NULL NULL
a2 NULL NULL NULL NULL NULL NULL
我想得到
3001-江南 GE 0 0 0 0 0
3016-江北4 E3/T3 0 0 0 0 0
求教谢谢
------解决方案--------------------
你这个有点误导啊,去重是要保留一条记录的,你的需求是有重复的数据都不保留
select * from (
select * from reportA where reportA.网元名称 not in (select reportB.网元名称 from reportB)
union all
select * from reportA where checksum(*) not in (select checksum(*) from reportB)
)a
group by 全部列名
having count(1)=1