简体   繁体   中英

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. And I need to SELECT where count goes from max count to min.

eg: I have 20 questions of What? and 30 questions of Wat? here it is shown: Wat? | 30 What? | 20

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

Thanks

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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