Oracle

[프로그래머스] 카테고리 별 도서 판매량 집계하기

dearbeany 2023. 11. 24. 02:04
select category, sum(sales) as total_sales
from
    (select a.book_id, a.category, b.sales_date, sales
    from book a, book_sales b
    where a.book_id = b.book_id
    and to_char(sales_date, 'yyyy-mm') = '2022-01'
    )
group by category
order by category
;