How can I write a query to list the total number of objects for each object type in ascending order of the number of types?
Object | Type
------- ------
1 metal
2 wood
3 metal
4 paper
5 paper
6 wood
7 wood
8 metal
9 plastic
10 wood
select `type`, count(*) as type_count
from your_table
group by `type`
order by count(*) asc
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.