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
':: DBMS ๐ฉ > ํ๋ก๊ทธ๋๋จธ์ค SQL ๊ณ ๋์ kit ํ์ด' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
JOIN>๋ณดํธ์์์ ์ค์ฑํํ ๋๋ฌผ (0) | 2023.02.26 |
---|---|
JOIN>์ฃผ๋ฌธ๋์ด ๋ง์ ์์ด์คํฌ๋ฆผ๋ค ์กฐํํ๊ธฐ (0) | 2023.02.26 |
JOIN>๊ทธ๋ฃน๋ณ ์กฐ๊ฑด์ ๋ง๋ ์๋น ๋ชฉ๋ก ์ถ๋ ฅํ๊ธฐ (0) | 2023.02.26 |
JOIN>์ค๋ ๊ธฐ๊ฐ ๋ณดํธํ ๋๋ฌผ(1) (0) | 2023.02.26 |
JOIN>์์๋๋ฐ์ ์์์ต๋๋ค (0) | 2023.02.26 |
๋๊ธ