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

with tmp as (
select t.user_id,sum(t.order_price) as total
from (
select user_id,order_price
from order_tb
where order_price > 100) as t
group by t.user_id) 

select t1.user_id,(t1.total + t2.point) as point
from tmp as t1
left join uservip_tb as t2
on t1.user_id = t2.user_id
order by point desc;

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务