dearbeany
[프로그래머스] 저자 별 카테고리 별 매출액 집계하기 본문
문제 잘못(내림차순) 나와있다.. author_id 는 오름차순으로 정렬해야 통과됨~
select a.author_id, a.author_name, c.category, c.total_sales
from author a,
(select b.author_id, b.category, sum(b.price* s.sales) as total_sales
from book b,
(select book_id, sum(sales) sales
from book_sales
where to_char(sales_date, 'yyyy-mm') ='2022-01'
group by book_id) s
where b.book_id = s.book_id
group by author_id, category) c
where a.author_id = c.author_id
order by 1, 3 desc;
'Oracle' 카테고리의 다른 글
[프로그래머스] 평균 일일 대여 요금 구하기 (0) | 2024.05.31 |
---|---|
[프로그래머스] 월별 잡은 물고기 수 구하기 (0) | 2024.03.17 |
[프로그래머스] 식품분류별 가장 비싼 식품의 정보 조회하기 (1) | 2023.11.25 |
[프로그래머스] 자동차 대여 기록에서 대여중 / 대여 가능 여부 구분하기 (1) | 2023.11.25 |
[프로그래머스] 자동차 종류 별 특정 옵션이 포함된 자동차 수 구하기 (1) | 2023.11.25 |