单个字段
select * from ZTEMP_DRUG_ATC where atc_code in(select atc_code from ZTEMP_DRUG_ATC group by atc_code having count(atc_code) >1)
DELETE ZTEMP_DRUG_ATC WHERE (atc_code) IN ( SELECT atc_code FROM ZTEMP_DRUG_ATC GROUP BY atc_code HAVING COUNT(atc_code) > 1)
AND ROWID NOT IN (SELECT MIN(ROWID) FROM ZTEMP_DRUG_ATC GROUP BY atc_code HAVING COUNT(*) > 1);
多个字段:
select * from code16 a where (a.codes,a.names) in(select b.codes,b.names from code16 b group by b.codes,b.names having count(*)>1);