I need to get a list of customer who ordered a particular product for the first time in a particular month and then sum how much of that items they have ordered since then. I started working on this but feel like I am going in the wrong direction - SQL is not my strong point.
So sample result data would be something like:
Num of Customers | Num of Orders | Total Revenue | Total Gross Profit
--------------------------------------------------------------------------
January 100 135 $1350 $725
Here are my tables (excluded columns not needed):
Customer
CustomerID
CustomerOrder
CustomerOrderID
CustomerID
OrderID
OrderDate
CustomerOrderItem
CustomerOrderItemID
OrderID
SKU
Price
Cost
Sample SKU would be something like 'ESK-1MVV' and profit is simply Price - Cost