Write a solution to report the products that were only sold in the first quarter of 2019
. That is, between 2019-01-01
and 2019-03-31
inclusive.
Return the result table in any order.
The result format is in the following example.
AND
전까지 2019
의 1분기로 나누고, AND
이후로 only 조건을 맞춘다.SELECT S.product_id, P.product_name FROM Product as P JOIN Sales as S
ON P.product_id = S.product_id
WHERE S.sale_date BETWEEN '2019-01-01' AND '2019-03-31'
AND S.product_id NOT IN
(
SELECT product_id FROM Sales
WHERE sale_date > '2019-03-31' OR sale_date < '2019-01-01'
)
GROUP BY 1, 2