随笔分类 - SqlServer_Northwnd_Study
摘要:每个城市中属于每种类别的消费者的数量select city,no_orders,upto_two_orders,more_than_two_orders from(select c.customerid,city,case when count(orderid) = 0 then 'no_orders' when count(orderid) <=2 then 'upto_two_orders' when count(orderid) >2 then 'more_than_two_orders'end as categoryfrom
阅读全文