Combine group by and count mysql

后端 未结 2 1630
轻奢々
轻奢々 2021-01-24 05:55

I need to find out all statuses in a table using group by:

SELECT status FROM table GROUP BY status

And then count the results found

         


        
2条回答
  •  南方客
    南方客 (楼主)
    2021-01-24 06:35

    Just group by status this will give you desired result

    select status, count(id) as COUNT FROM table GROUP BY status
    

提交回复
热议问题