G
Guest
I've searched for this and the answers aren't quite what I'm looking for.
I have tables Order and OrderDetails. I use a query to total the Cost field
in OrderDetails:
SELECT DISTINCTROW [OrderDetails Query].OrderID, Sum([OrderDetails
Query].ExtendedPrice) AS [Sum Of ExtendedPrice]
FROM [OrderDetails Query]
GROUP BY [OrderDetails Query].OrderID
ORDER BY [OrderDetails Query].OrderID;
This works fine. It sums all Costs with the same OrderID as you'd expect.
I'd now like to have a seperate query that sums all costs where the OrderDate
(stored in Order) are in the same month (ie a Monthly Total). I can do this
for the current month:
SELECT Sum([OrderDetails Subtotals].[Sum Of ExtendedPrice]) AS [SumOfSum Of
ExtendedPrice]
FROM ([Order] INNER JOIN [OrderDetails Subtotals] ON Order.OrderID =
[OrderDetails Subtotals].OrderID) INNER JOIN OrderDetails ON Order.OrderID =
OrderDetails.OrderID
WHERE (((Order.OrderDate) Between DateSerial(Year(Date()),Month(Date()),1)
And DateSerial(Year(Date()),Month(Date())+1,0) Or (Order.OrderDate) Between
DateSerial(Year(Date()),Month(Date()),1) And
DateSerial(Year(Date()),Month(Date())+1,0)));
but for some reason (call it brainfade), can't do it for every month. I'd
like the OrderDate field formatted as "January" etc if possible.
Ideas?
Thanks
Dave
I have tables Order and OrderDetails. I use a query to total the Cost field
in OrderDetails:
SELECT DISTINCTROW [OrderDetails Query].OrderID, Sum([OrderDetails
Query].ExtendedPrice) AS [Sum Of ExtendedPrice]
FROM [OrderDetails Query]
GROUP BY [OrderDetails Query].OrderID
ORDER BY [OrderDetails Query].OrderID;
This works fine. It sums all Costs with the same OrderID as you'd expect.
I'd now like to have a seperate query that sums all costs where the OrderDate
(stored in Order) are in the same month (ie a Monthly Total). I can do this
for the current month:
SELECT Sum([OrderDetails Subtotals].[Sum Of ExtendedPrice]) AS [SumOfSum Of
ExtendedPrice]
FROM ([Order] INNER JOIN [OrderDetails Subtotals] ON Order.OrderID =
[OrderDetails Subtotals].OrderID) INNER JOIN OrderDetails ON Order.OrderID =
OrderDetails.OrderID
WHERE (((Order.OrderDate) Between DateSerial(Year(Date()),Month(Date()),1)
And DateSerial(Year(Date()),Month(Date())+1,0) Or (Order.OrderDate) Between
DateSerial(Year(Date()),Month(Date()),1) And
DateSerial(Year(Date()),Month(Date())+1,0)));
but for some reason (call it brainfade), can't do it for every month. I'd
like the OrderDate field formatted as "January" etc if possible.
Ideas?
Thanks
Dave