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

你可能感兴趣的:(oracle)