Hi I'm trying to count order records with users who made more than one order in a month like 2018-01-01 to 2018-02-01.
Order table
id user_id date
1 12 2017-01-02
2 23 2018-01-03
3 12 2018-01-04
4 12 2018-01-08
....
User table
id
12
23
....
What I need is a number of Order records in a certain month
Output
output should be 2 which means user_id 12 is already made an order in 2017-01-02 so id in Order table 3 and 4 are records I need to count. Then summate the total records
I think I need to get order records first and find order records again with certain user_id. But I'm stuck Is there a way to accomplish this task? Thanks