sql query table for data records with the same field value

There are fields id, name, age in table T (Note: id has the same value) Query data records with the same id and greater than 1

select * from T a where exists (select id from T where id=a.id group by id having count(*)>1)

If you need to query for the existence of the same value for name, replace id with name.

Guess you like

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