r/learnSQL • • May 01 '26

SQL Question

orders (order_id , customer_id , order_date , order_amount)

find the customer who purchased for every month in 2025

19 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/aais4quiters May 01 '26

This will work if a customer only orders once a month. If the customer orders 2 times a month for 6 months it would show on the list when they only ordered in 6 separate months not each month. You’re going to need a subquery of customer number to get a result set of unique customer numbers and month numbers.