SQL프로그래밍

프로그래머스 레벨4 저자별 카테고리 별 매출액 집계하기

노마드선샤인 2025. 5. 24. 23:13
728x90

 

select a.author_id, b.author_name, a.category, sum(a.price * c.sales)
from book a, author b, book_sales c
where 1=1
and to_char(c.sales_date, 'YYYYMM') = '202201'
and a.author_id = b.author_id
and a.book_id = c.book_id
group by a.author_id, b.author_name, a.category
order by 1, 3 desc

728x90