mysql query duplicate data

When there is dirty duplicate data in our database, we have to query the existing dirty duplicate data. How many are there? Then this statement is needed.

> select * from table name WHERE field name in (select field name from table name group by field name having count(field name) > 1)
eg:
select * from user WHERE cId in (select cId from user group by cId having count( cId) > 1)

Little knowledge points

group by 后面是不可以跟where的

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325706955&siteId=291194637
Recommended