Skip to content

Commit

Permalink
Time: 896 ms (88.93%), Space: 0B (100.00%) - LeetHub
Browse files Browse the repository at this point in the history
  • Loading branch information
joseantoniochacon committed Sep 30, 2024
1 parent fb7271d commit 9c0ec79
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Write your MySQL query statement below

SELECT SalesTable.product_id, year AS first_year, quantity, price FROM Sales SalesTable JOIN (SELECT product_id, MIN(year) min_year FROM Sales GROUP BY product_id) AS MinValueTable ON SalesTable.product_id = MinValueTable.product_id WHERE SalesTable.year = MinValueTable.min_year AND SalesTable.product_id = MinValueTable.product_id

0 comments on commit 9c0ec79

Please sign in to comment.