mysql 筛选重复项(单列或者多列同时重复)mysql去重

原文:https://blog.csdn.net/luyaran/article/details/80929026

 

-------------单列-----------------------

SELECT
检查字段,
COUNT(检查字段)
FROM
table_name
GROUP BY 检查字段
HAVING COUNT(检查字段) > 1

 

-------------多列------------------

SELECT
检查字段1, COUNT(检查字段1),
检查字段2, COUNT(检查字段2),
...

FROM
table_name
GROUP BY
检查字段1,
检查字段2, ...
HAVING
(COUNT(检查字段1) > 1) AND
(COUNT(检查字段2) > 1) AND
 

posted @ 2019-01-08 17:04  这个名字想了很久~  阅读(3210)  评论(0编辑  收藏  举报