筛选重复数据
-------------单列-----------------------
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
如:
SELECT
activity_id, COUNT(activity_id),
user_id, COUNT(user_id),
gmt_activity, COUNT(gmt_activity),
classes_type, COUNT(classes_type),
gmt_create, COUNT(gmt_create),
gmt_modified, COUNT(gmt_modified),
state, COUNT(state),
is_deal, COUNT(is_deal)
FROM
activity_user
GROUP BY
activity_id,
user_id,
gmt_activity,
classes_type,
gmt_create,
gmt_modified,
state,
is_deal
HAVING
(COUNT(activity_id) > 1) AND
(COUNT(user_id) > 1) AND
(COUNT(gmt_activity) > 1) AND
(COUNT(classes_type) > 1) AND
(COUNT(gmt_create) > 1) AND
(COUNT(gmt_modified) > 1) AND
(COUNT(state) > 1) AND
(COUNT(is_deal) > 1)