select
b.product_name,
cast(sum(b.price) as signed) as total
from
user_client_log a
left join product_info b using (product_id)
where
a.step = 'select'
and a.pay_method is not null
group by
b.product_name
order by
total desc
limit
2

京公网安备 11010502036488号