使用 GROUP BY 检索满足条件的记录

发布于 2024-08-17 08:12:11 字数 205 浏览 11 评论 0原文

我现在只想从几千条记录中选择计数大于 1 的行(换句话说,重复项),我大多看到 1 和一些 2 和 3,

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

我该怎么做?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

一人独醉 2024-08-24 08:12:11
SELECT count( * ) AS `Number` , GI . *
FROM `GeneralInformation` AS GI
GROUP BY `FirstName` , `Surname` 
HAVING count(*)>1
SELECT count( * ) AS `Number` , GI . *
FROM `GeneralInformation` AS GI
GROUP BY `FirstName` , `Surname` 
HAVING count(*)>1
浮华 2024-08-24 08:12:11

使用having子句

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

Use the Having clause

SELECT count( * ) AS `Number` , GI . *
FROM `GeneralInformation` AS GI
GROUP BY `FirstName` , `Surname` 
HAVING count( * ) > 1
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文