简体   繁体   中英

How to group and count grouped mysql results

I've been trying and searched for this but I seem unable to fix. Here my screenshot. 分组并统计分组的mysql结果

Now my issue is I want to group the above results by 'form_class'. In this case, the 2's should be grouped and counted as 2 because there are 2 rows while the 4's as 3 because of the 3 rows returned..

Try Below query

SELECT form_class,
       COUNT(*) AS COUNT_FORM_CLASS 
FROM ekwendeni_girls.term_reports
GROUP BY form_class

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