题解 | 更新用户积分信息?

更新用户积分信息?

https://www.nowcoder.com/practice/ef1f2fda4338460b948810f3f7e7a68e

select
	t.user_id,
	t.newpoint+t.point as point
from
	(select
		o.user_id,
		sum(o.order_price) as newpoint,
		u.point
	from
    	order_tb o
    left join 
        uservip_tb u 
    on 
        o.user_id=u.user_id
	where
    	o.order_price>100
    group by 
		o.user_id,u.point) t
group by t.user_id,t.newpoint,t.point
order by point desc;

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务