chenzhelove

oracle 去掉重复的数据

原理

根据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)

 

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-03
猜你喜欢
  • 2021-10-11
  • 2022-01-19
  • 2022-01-01
  • 2021-11-27
  • 2022-12-23
  • 2022-12-23
  • 2021-12-09
相关资源
相似解决方案