I have a db:
---------------------
| section | name |
---------------------
| food | steak |
---------------------
| food | chicken |
---------------------
| drink | water |
---------------------
| food | pork |
---------------------
| drink | soda |
---------------------
| drink | steak |
---------------------
I am trying to count the number of rows with each section. The problem is, I don’t have static section names. I am trying to do it with one query.
Here is the result I am looking for:
-------------
| food | 3 |
-------------
| drink | 3 |
-------------
1 Answer