I have 3 mysql tables looks like this :
- product(product_id, name)
- order(order_id, order_date)
- order_detail(order_detail_id, product_id, order_id, quantity)
I want to get the sum of the quantities of product sold in the last 3 months and grouping them by the product like this :
product_id | quantity_sold_last_3_mouth
1 | 50
2 | 156
3 | 78
The problem is how to join only the rows of the table order_detail that are creating the last threes month since the date is set only in the table order
Thanks a lot for any idea or help