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

JOIN>์ƒํ’ˆ ๋ณ„ ์˜คํ”„๋ผ์ธ ๋งค์ถœ ๊ตฌํ•˜๊ธฐ

by EunBird 2023. 2. 26.

mysql

-- ์ฝ”๋“œ๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”
SELECT A.PRODUCT_CODE, **SUM**(A.PRICE * B.SALES_AMOUNT) AS SALES
FROM PRODUCT A
**JOIN** OFFLINE_SALE B 
ON A.PRODUCT_ID = B.PRODUCT_ID
**GROUP BY PRODUCT_CODE**
ORDER BY SALES DESC, PRODUCT_CODE

JOIN = INNER JOIN

728x90

๋Œ“๊ธ€