作者: | 来源:互联网 | 2023-08-30 09:46
select r_seller.r_name as 渠道 , count(r_saleorder.r_orderstatus) as 订单数
from r_saleorder left join r_seller on r_seller.r_sellerid = r_saleorder.r_sellerid
group by r_seller.r_name
上面是我统计的代码,只能统计某个渠道的所有的订单,我如何根据订单状态统计订单数,如:
select r_seller.r_name as 渠道 ,
count(1) as 已付款,
count(1) as 已审核,
count(1) as 退货
from r_saleorder left join r_seller on r_seller.r_sellerid = r_saleorder.r_sellerid
group by r_seller.r_name
如何统计呢?
3 个解决方案