问题描述:

I want to LIMIT Grouped results to 30, but instead I'm grouping all rows and then limiting it to 30 groups. How do I do the opposite?

SELECT *, COUNT(*) AS COUNT FROM `Posts` GROUP By `Category` LIMIT 30

网友答案:
SELECT *, COUNT(*) AS COUNT FROM (SELECT * FROM `Posts` LIMIT 30) t GROUP By `Category`
相关阅读:
Top