原理
根据id,count(id),查出需要去重id,去掉id,
具体可以为
select * from 表名 where id not in (select id ,count(id) from 表名 group by id having count(id)>1)
当然表名也可以为结果集
select * from ( with t AS ( SELECT id,pqmc,to_char(pqdd) AS aa from uf_pqjzb WHERE pqdd IS NOT NULL --AND ID =‘57‘ ) select id,pqmc,regexp_substr(aa, ‘[^,]+‘, 1, level) as pqdd from t connect by level <= regexp_count(aa, ‘\,\‘) + 1 and aa = prior aa and prior dbms_random.value > 0 ) a where a.pqdd NOT in (SELECT pqdd FROM ( with t AS ( SELECT id,pqmc,to_char(pqdd) AS aa from uf_pqjzb WHERE pqdd IS NOT NULL --AND ID =‘57‘ ) select id,pqmc,regexp_substr(aa, ‘[^,]+‘, 1, level) as pqdd from t connect by level <= regexp_count(aa, ‘\,\‘) + 1 and aa = prior aa and prior dbms_random.value > 0) GROUP BY pqdd HAVING COUNT(pqdd)>1)