[프로그래머스 SQL 고득점 Kit] GROUP BY: 저자 별 카테고리 별 매출액 집계하기

jieunee·2023년 4월 1일
0

🤔 문제


✅ 정답

SELECT A.AUTHOR_ID, AUTHOR_NAME, CATEGORY, SUM(PRICE * SALES) AS TOTAL_SALES 
FROM BOOK AS A JOIN AUTHOR AS B ON A.AUTHOR_ID = B.AUTHOR_ID JOIN BOOK_SALES AS C ON A.BOOK_ID = C.BOOK_ID
WHERE C.SALES_DATE LIKE '2022-01%'
GROUP BY A.AUTHOR_ID, CATEGORY
ORDER BY A.AUTHOR_ID ASC, CATEGORY DESC
profile
Back-End Developer 🌱

0개의 댓글