Wednesday, October 14, 2020

Find duplicate rows with count

 https://blog.theodo.com/2018/01/search-destroy-duplicate-rows-postgresql/


SELECT
  firstname,
  lastname,
  count(*)
FROM people
GROUP BY
  firstname,
  lastname
HAVING count(*) > 1;
+-----------+-----------+-------+
| firstname | lastname  | count |
+-----------+-----------+-------+
| Maria     | Green     |   3   |
| Paul      | Jones     |   2   |
+-----------+-----------+-------+

No comments:

Post a Comment

Guitar Chords

click on   Guitar Chords Family