簡體   English   中英

如何計算一列中不同類型的多個總數

[英]How to count multiple total number of different types in one column

如何編寫查詢以按類型數量的升序列出每種對象類型的對象總數?

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM