9

我现在只想从几千条记录中选择计数大于 1 的行(即重复项)

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

我怎样才能做到这一点?

4

2 回答 2

9
SELECT count( * ) AS `Number` , GI . *
FROM `GeneralInformation` AS GI
GROUP BY `FirstName` , `Surname` 
HAVING count(*)>1
于 2010-01-04T03:01:25.810 回答
7

使用 Have 子句

SELECT count( * ) AS `Number` , GI . *
FROM `GeneralInformation` AS GI
GROUP BY `FirstName` , `Surname` 
HAVING count( * ) > 1
于 2010-01-04T03:00:54.813 回答