展开 GROUP BY 和 HAVING 结果集
有没有办法扩展/获取 GROUP BY 和 HAVING 查询的所有记录?
例如,
SELECT Column1, Column2, Column3, Count(*) as Count FROM table_name
GROUP BY Column1, Column2, Column3
HAVING Count > '2'
是否有一种更简单的方法来获取所有记录,而不是遍历结果集并执行 SELECT * FROM table_name WHERE Column1 = 'this' AND Column2 = 'that' AND Column3 = 'more' 对于每条记录。
如果由于mysql或其他一些限制而无法完成,是否有其他方法可以获取上面查询
的所有数据?
通过展开/获取所有记录,我的意思是如果结果集是
Value1 Value2 Value3 4
我希望能够获取所有 4 条记录。
Is there a way to expand/get all the records of a GROUP BY
and HAVING
query?
For example,
SELECT Column1, Column2, Column3, Count(*) as Count FROM table_name
GROUP BY Column1, Column2, Column3
HAVING Count > '2'
Is there an easier way to get all the records rather than going through the result set and doing SELECT * FROM table_name WHERE Column1 = 'this' AND Column2 = 'that' AND Column3 = 'more'
for each record.
If it cannot be done due to mysql or some other restrictions is there any other way to get all the data for query
above?
By expand/get all the records, I mean if the result set is
Value1 Value2 Value3 4
I want to be able to get all the 4 records.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的意思是这样的吗:
这基本上是您在问题中描述的内容,但在
JOIN
中。Do you mean something like this:
This is basically what you described in your question but in a
JOIN
.