MySQL多字段重复记录淘选
程序员文章站
2024-01-10 20:25:52
...
MySQL多字段重复记录筛选 MySQL多字段重复记录筛选: select * from T_CELLID TC where (TC.MCC,TC.MNC,TC.LAC,TC.CELL,TC.LNG,TC.LAT) in (select MCC,MNC,LAC,CELL,LNG,LAT from T_CELLID group by MCC,MNC,LAC,CELL,LNG,LAT having count(*) 1) and TC.id
MySQL多字段重复记录筛选MySQL多字段重复记录筛选:
select * from T_CELLID TC
where (TC.MCC,TC.MNC,TC.LAC,TC.CELL,TC.LNG,TC.LAT) in (select MCC,MNC,LAC,CELL,LNG,LAT from T_CELLID group by MCC,MNC,LAC,CELL,LNG,LAT having count(*) > 1)
and TC.id not in (select min(id) from T_CELLID group by MCC,MNC,LAC,CELL,LNG,LAT having count(*)>1)