with t as (
select product_id, product_name, type, price
from (
select product_id, price, type, product_name,
dense_rank() over (partition by type order by price desc) as dr
from product_info
) temp
where dr<=2
)
select product_id, product_name, type, price
from t
order by price desc, product_name
limit 3

京公网安备 11010502036488号