I have 2 relational tables orders and order_items orders has
id
customer_name
delivery_date
order_items has
- order_id
- item
- unit
- qty
I need to see how much (ie. Sum(qty)) of each item/unit combination each customer ordered with in a specified date range.
the only way I see this can be done is to use C# or vb.net and first create a datatable with distinct item/unit combinations for the date range. The I would loop through those item/units and get a total for a customer for them in that date range and add them to another datatable.
Is there a way to do this in sql alone?