我的类别未知(动态)。我想获得每个类别中的记录计数以及要在图表中实现的计数的类别名称。有什么建议吗?
答案 0 :(得分:4)
select count(*) as cat_count, category from table_name group by category
答案 1 :(得分:2)
select count(*), category from <table> group by category
答案 2 :(得分:0)
select count(id) as count, category_name from category group by category_name