๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
  • Welcome.
:: DBMS ๐Ÿšฉ/ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค SQL ๊ณ ๋“์  kit ํ’€์ด

JOIN>5์›” ์‹ํ’ˆ๋“ค์˜ ์ด๋งค์ถœ ์กฐํšŒํ•˜๊ธฐ

by EunBird 2023. 2. 26.
SELECT A.PRODUCT_ID, A.PRODUCT_NAME, **SUM**(B.AMOUNT*A.PRICE) AS TOTAL_SALES
FROM FOOD_PRODUCT A
JOIN FOOD_ORDER B ON A.PRODUCT_ID = B.PRODUCT_ID
WHERE B.PRODUCE_DATE LIKE '2022-05-%'
**GROUP BY PRODUCT_ID**
ORDER BY TOTAL_SALES DESC, PRODUCT_ID
728x90

๋Œ“๊ธ€