Using Subquery and self join
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/* Write your T-SQL query statement below */\nselect a.product_id, a.first_year, s.quantity, s.price\nfrom (\nselect product_id, min(year) as first_year\nfrom Sales \ngroup by product_id\n) a\njoin Sales s\non a.product_id= s.product_id\nand a.first_year= s.year\n```
['MS SQL Server']