是否可以使用 MYSQL GROUP BY 选择堆栈值
我收到这样的查询:
SELECT email
FROM abc_table
GROUP BY email
HAVING ( COUNT(email) > 1 )
所以它会返回我:
email
[email protected]
[email protected]
[email protected]
现在我需要调整查询以获得这样的结果:
email id
[email protected] 1
[email protected] 2
[email protected] 3
[email protected] 4
[email protected] 5
[email protected] 6
是否可以通过使用 GROUP BY HAVING 获得此结果?或者有什么建议可以得到这个结果吗?
多谢!
I got a query like this :
SELECT email
FROM abc_table
GROUP BY email
HAVING ( COUNT(email) > 1 )
So it will return me :
email
[email protected]
[email protected]
[email protected]
And now i need to adjust the query to get something like this :
email id
[email protected] 1
[email protected] 2
[email protected] 3
[email protected] 4
[email protected] 5
[email protected] 6
Is it posible to get this result by using GROUP BY HAVING ? Or any suggestion to get this result?
Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
使用 GROUP_CONCAT:(
编辑:误读问题)
Use GROUP_CONCAT:
(EDIT: misread the question)