欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

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)