select
    t.product_id,
    t.product_name,
    t.type,
    t.price
from
    (select
        product_id,
        price,
        type,
        product_name,
        rank() over(partition by type order by price desc) as rk
    from
        product_info) t
where 
    rk <= 2
order by 
    t.price desc,t.product_name
limit 3