with t as(
select
user_id,
sum(order_price) as ad
from
order_tb
where order_price>100
group by user_id
)
select
user_id,
point+t.ad as point
from uservip_tb
left join
t
using(user_id)
where t.ad is not null
order by point desc

京公网安备 11010502036488号