根据两个字段查询重复数据 (roleid,userid)
select * from role_user a where (a.roleid,a.userid) in(select roleid,userid from role_user group by roleid,userid having count(*) > 1)删除重复数据只保留一条
delete from role_user where rowid not in (select min(rowid) from role_user group by roleid , userid )
下面的只根据userid进行查询与删除
select count(1),USERID from role_user group by USERID HAVING count(1)>1 DELETE from role_user WHERE (userid) IN ( SELECT userid FROM role_user GROUP BY userid HAVING COUNT(userid) > 1) AND ROWID NOT IN (SELECT MIN(ROWID) FROM role_user GROUP BY userid HAVING COUNT(*) > 1);
转载于:https://www.cnblogs.com/QW-lzm/p/10761053.html
相关资源:各显卡算力对照表!