表中数据根据多字段去重

SELECT *  from (SELECT *, CONCAT(UserID,CompanyId) as uc from newuserauthority) t WHERE t.uc in
(
SELECT uc from (SELECT CONCAT(UserID,CompanyId) as uc from newuserauthority) tt GROUP BY uc HAVING count(uc) > 1
);

猜你喜欢

转载自www.cnblogs.com/lovemj/p/9337170.html