Retrieving records fulfilling a condition using GROUP BY

后端 未结 2 1927
渐次进展
渐次进展 2021-01-02 07:38

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

相关标签:
2条回答
  • 2021-01-02 08:18

    Use the Having clause

    SELECT count( * ) AS `Number` , GI . *
    FROM `GeneralInformation` AS GI
    GROUP BY `FirstName` , `Surname` 
    HAVING count( * ) > 1
    
    0 讨论(0)
  • 2021-01-02 08:22
    SELECT count( * ) AS `Number` , GI . *
    FROM `GeneralInformation` AS GI
    GROUP BY `FirstName` , `Surname` 
    HAVING count(*)>1
    
    0 讨论(0)
提交回复
热议问题