Hi guys,
I've just knocked up a query to get the daily sales figures out of the database and wonder if someone can have a look to see if I've missed anything obvious. It all seems to work OK, but you never know. Sellerdeck no longer release information about the schema, so you have to just suck it and see.
Anyway, here's my code:
I've just knocked up a query to get the daily sales figures out of the database and wonder if someone can have a look to see if I've missed anything obvious. It all seems to work OK, but you never know. Sellerdeck no longer release information about the schema, so you have to just suck it and see.
Anyway, here's my code:
Code:
SELECT Date_Ordered ,sum(ord_total_cost+ord_ship_tot_cost+ord_disc_cost) as total_daily_sales FROM (SELECT Order.[Order Number] ,Format(Order.[Date Ordered],"Short Date") AS Date_Ordered ,Sum(OrderDetail.[TotalCost])/100 AS ord_total_cost , Order.[Shipping Total Cost]/100 AS ord_ship_tot_cost , Order.[Discount Cost]/100 AS ord_disc_cost FROM [Order] INNER JOIN OrderDetail ON Order.[Order Sequence Number] = OrderDetail.OrderSequenceNumber where OrderDetail.Status <> "C" GROUP BY Order.[Order Number] , Format(Order.[Date Ordered],"Short Date") , Order.[Shipping Total Cost] , Order.[Discount Cost]) AS TOTALS GROUP BY TOTALS.DATE_ORDERED
Comment