[프로그래머스] ⭐⭐ 성분으로 구분한 아이스크림 총 주문량 (MySQL)
문제
코드
ver(1) - JOIN 사용
SELECT B.INGREDIENT_TYPE, SUM(A.TOTAL_ORDER) AS TOTAL_ORDER
FROM FIRST_HALF AS A
JOIN ICECREAM_INFO AS B
ON A.FLAVOR = B.FLAVOR
GROUP BY B.INGREDIENT_TYPE
ver(2) - WHERE 사용
SELECT I.INGREDIENT_TYPE, SUM(F.TOTAL_ORDER) AS TOTAL_ORDER
FROM ICECREAM_INFO I, FIRST_HALF F
WHERE I.FLAVOR=F.FLAVOR
GROUP BY I.INGREDIENT_TYPE
ORDER BY TOTAL_ORDER;
댓글남기기