select
product_name,
price1 * amount as price
from (
select
product_name,
price as price1,
count(trace_id) as amount
from user_client_log
join product_info using(product_id)
where step = "select" and pay_method IS NOT NULL
group by product_name,price
) as t1
order by price desc
limit 2

京公网安备 11010502036488号