Oracle

[프로그래머스] 식품분류별 가장 비싼 식품의 정보 조회하기

dearbeany 2023. 11. 25. 02:29
select a.category, b.max_price, a.product_name
from FOOD_PRODUCT a, (
    select category, max(price) as max_price
    from food_product
    where category in ('과자', '국', '김치', '식용유')
    group by category) b
where a.category = b.category
and a.price = b.max_price
order by 2 desc;