[英]how can i count number of orders and then group them using case statements in SQL
所以我有一個看起來像這樣的表:[table image]
我想要的 output 是這樣的:[我想要的 output 圖像]
似乎是一個簡單的分組和計數:
select cust_id , count(*) ordrnumber , concat('ordered ' , count(*),' time(s)') as group
from table
group by cust_id
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.