9

I'd like to only select the rows where the count is greater than 1 (in other words the duplicates) right now from a few thousand records I am mostly seeing 1s with a few 2s and 3s here and there

SELECT count( * ) AS `Number` , GI . *
FROM `GeneralInformation` AS GI
GROUP BY `FirstName` , `Surname` 

how can I do this?

Moak
  • 12,596
  • 27
  • 111
  • 166

2 Answers2

9
SELECT count( * ) AS `Number` , GI . *
FROM `GeneralInformation` AS GI
GROUP BY `FirstName` , `Surname` 
HAVING count(*)>1
Mike Tunnicliffe
  • 10,674
  • 3
  • 31
  • 46
7

Use the Having clause

SELECT count( * ) AS `Number` , GI . *
FROM `GeneralInformation` AS GI
GROUP BY `FirstName` , `Surname` 
HAVING count( * ) > 1
mopoke
  • 10,555
  • 1
  • 31
  • 31