题解 | 统计各等级会员用户下订单总额 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

全部评论

相关推荐

评论
点赞
收藏
分享
牛客网
牛客企业服务