1 a
2 b
3 c
4 a
5 a
6 b
Calculate a how many, in the second column is to realize the best
A 3
2 b
C 1
Excuse me, how to implement, need through SQL?
CodePudding user response:
The SELECT field 2, count (column 2) FROM table GROUP BY field 2;CodePudding user response:
Your example happens to be the order of the descending order of count and data, generally available:The SELECT field 2, count (column 2) FROM table GROUP BY field 2 ORDER BY count (column 2) DESC;
CodePudding user response:
A SQL statement can be achieved:The select field, the count number (field) as the from table group by field