oracle中SQL语句的一些有效常用用法

1.查找表a中有而表b中没有的数据

select djbh from zj_splzyjb  a 
where not exists (select djbh from zj_splzb  b where  a.djbh=b.djbh)

2.搜索表a中的djbh,xh两个字段不唯一的记录即重复记录

select djbh||'-'||xh as djbhxh,count(djbh)
from zj_fybxbd b  group by djbh,xh

原文地址:https://www.cnblogs.com/superch0054/p/4010262.html