Leetcode - 1084. Sales Analysis III
문제
정답
SELECT Product.product_id, product_name
FROM Product
JOIN (SELECT product_id, MIN(sale_date) as min_date, MAX(sale_date) as max_date
FROM Sales GROUP BY product_id
) As NewSales
ON Product.product_id = NewSales.product_id
WHERE NewSales.min_date BETWEEN '2019-01-01' AND '2019-03-31'
AND NewSales.max_date BETWEEN '2019-01-01' AND '2019-03-31'