各位大侠,小弟刚刚接触SQL,现在有A B两张表,A是总表,B是临时表,目的是首先筛选B表不存在于A表中的记录,但是B表中的数据有可能有重复,导致筛选出的数据有可能有重复,如何再对重复的数据进行筛选?
select * from lsb where not exists (select * from xyzb where xyzb.税号=lsb.税号 and xyzb.软件=lsb.软件)
这是我进行筛选B表中不存在于A表的记录,但是我不知道如何去筛选重复的数据了,多谢各位大侠帮忙
------解决方案--------------------
貌似就是你这么写.
select * from lsb where not exists (select * from xyzb where xyzb.税号=lsb.税号 and xyzb.软件=lsb.软件)
或者:
select distinct * from lsb where not exists (select * from xyzb where xyzb.税号=lsb.税号 and xyzb.软件=lsb.软件)