✅"Easy-way to solve this mysql problem"|99.50% beats|💯🎯😊
Approachwe want to the task is to select the product,year,quantity,price for the first year of sales for every product.Code

# Approach
<!-- Describe your approach to solving the problem. -->
**we want to the task is to select the product,year,quantity,price for the first year of sales for every product.**

# Code
```mysql []
# Write your MySQL query statement below
WITH FirstYearSales AS (SELECT product_id,MIN(year) AS first_year 
FROM Sales GROUP BY product_id)SELECT s.product_id,f.first_year,s.quantity,s.price
FROM FirstYearSales f JOIN Sales s ON f.product_id = s.product_id AND f.first_year = s.year;

```
['MySQL']