select
*
from (
select
pi.product_name,
pi.price * a.cnt as total_price
from
product_info as pi
left join (
select
product_id,
count(pay_method) as cnt
from
user_client_log
where
pay_method != ''
group by
product_id
)a
on
pi.product_id = a.product_id
order by
total_price desc
)b
where
total_price is not null
limit 2


京公网安备 11010502036488号