简体   繁体   English

从表格中选择COUNT列从最大值到最小值的数据

[英]choose the data from the table where COUNT of columns goes from max to min

I have a table of questions, I need to show tha TOP of 20 questions. 我有一个问题表,我需要显示20个问题的TOP。 And I need to SELECT where count goes from max count to min. 我需要SELECT从最大计数到最小计数。

eg: I have 20 questions of What? 例如:我有20个问题是什么? and 30 questions of Wat? 还有30个问题? here it is shown: Wat? 这里显示:Wat? | | 30 What? 30什么? | | 20 20

SELECT *, COUNT(question) AS q 
FROM stat_otp_questions ".$filter."  
GROUP BY question ORDER BY q  LIMIT 20

Thanks 谢谢

你可以说ORDER BY q DESC所以它排序下降

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM