题解 | 统计各等级会员用户下订单总额 right join (会员等级留全)
select vip, if(sum(order_price)>0,sum(order_price),0) order_total from order_tb o right join uservip_tb u on o.user_id=u.user_id group by vip order by order_total desc
select vip, if(sum(order_price)>0,sum(order_price),0) order_total from order_tb o right join uservip_tb u on o.user_id=u.user_id group by vip order by order_total desc
相关推荐