delete FROM `test_table` WHERE id in (SELECT id,concat(user_id,user_id2) as __fFROM `test_table` where user_id = 11GROUP BY `__f` HAVING COUNT( * ) >1) and id not in (SELECT min(id),concat(user_id,user_id2) as __fFROM `test_table` where user_id = 11G…
select count(*) '个数',mobile '手机号',`name` '用户名' from users group by mobile having(count(*) > 1); ================================= having的用法 having字句可以让我们筛选成组后的各种数据,where字句在聚合前先筛选记录,也就是说作用在group by和having字句前.而 having子句在聚合后对组记录进行筛选. SQL实例: 一.显示每个地区的总人口…