Leetcode - 1070. Product Sales Analysis III

문제

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 Sales.product_id, first_year, quantity, price
FROM Sales
JOIN (
    SELECT product_id, MIN(year) as first_year
    FROM Sales
    GROUP BY product_id
) as Temp ON Sales.year = Temp.first_year AND Sales.product_id = Temp.product_id