Skip to content

Commit c907ed6

Browse files
authored
Update products-with-three-or-more-orders-in-two-consecutive-years.sql
1 parent de40a79 commit c907ed6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

MySQL/products-with-three-or-more-orders-in-two-consecutive-years.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ WITH consecutive_cte AS
77
LEAD(YEAR(purchase_date), 1) OVER(PARTITION BY product_id
88
ORDER BY YEAR(purchase_date)) - YEAR(purchase_date) AS year_diff
99
FROM orders
10-
GROUP BY curr_year, product_id
10+
GROUP BY 1, 2
1111
HAVING COUNT(order_id) >= 3
1212
ORDER BY NULL
1313
)

0 commit comments

Comments
 (0)