1、sql 查表重复数据
Select * From 表XX Where user_id In (Select user_id From 表XX Group By user_id Having Count(*)>1)
2、sql 查表重复数据
Select user_id From 表XX Group By user_id Having Count(*)>1
删除重复数据保留一条记录 保留一条
DELETE FROM 表XX WHERE user_id IN (select user_id from (
SELECT user_id FROM 表XX GROUP BY user_id HAVING COUNT(*) > 1) a )
AND id NOT IN (select id from ( SELECT min(id) id FROM 表XX GROUP BY user_id HAVING count(id) > 1) b