Leetcode - 1045. Customers Who Bought All Products
문제
정답
SELECT customer_id
FROM (SELECT DISTINCT customer_id, customer_id + '_' + product_key FROM Customer) as Temp
GROUP BY customer_id
HAVING COUNT(customer_id) = (SELECT COUNT(*) FROM Product)
SELECT customer_id
FROM (SELECT DISTINCT customer_id, customer_id + '_' + product_key FROM Customer) as Temp
GROUP BY customer_id
HAVING COUNT(customer_id) = (SELECT COUNT(*) FROM Product)