https://school.programmers.co.kr/learn/courses/30/lessons/62284
GROUP_CONCAT이용 서브쿼리
SELECT CART_ID
FROM (
SELECT CART_ID, GROUP_CONCAT(NAME) AS NAMES
FROM CART_PRODUCTS
GROUP BY CART_ID
) TMP
WHERE NAMES LIKE '%Milk%'
AND NAMES LIKE '%Yogurt%'
;
서브쿼리 이용 풀이
SELECT
CART_ID
FROM
CART_PRODUCTS
WHERE CART_ID IN(SELECT
CART_ID
FROM
CART_PRODUCTS
WHERE NAME='MILK')
AND NAME='YOGURT'
GROUP BY CART_ID;
이런식으로 조회 결과물들을 이어붙이는 느낌이었다.
https://fruitdev.tistory.com/16
https://blue-boy.tistory.com/194