Leetcode - 1045. Customers Who Bought All Products
문제
Loading...
Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview.
정답
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)