查找表中重复数据的sql
group by 是分组
having 是筛选分组后的各组数据
group by 字段 having count(1) > 1
SELECT count(1) , a.user_id from (
SELECT user_id from sys_user_role WHERE role_id IN ("200000000000100004101","2000000000001000041") )as a GROUP BY a.user_id HAVING count(1) > 1