Complex Querie

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a database that we are currently using as order tracking. Each order
gets entered on the day it was ordered, and we store an "Order Date" field
with each record. I am trying to come up with a querie that will give me a
'running tally' (possibly as a pivot chart) on how many orders we took in
each month (from when we started through the current month). Is there an
easy way to do this so that we can just re-run the report/querie everytime we
want to look at this data? (I am guessing there is a way to do this, however
it is beyond my scope of expertise). Any help would be greatly appreciated.
 
Complex? Nah! :-)

SELECT Year([OrderDate]) AS [Year], Month([OrderDate]) AS [Month],
Count(tblOrders.OrderID) AS CountOfOrderID
FROM tblOrders
GROUP BY Year([OrderDate]), Month([OrderDate]);

Where 'OrderDate' is your date field, 'tblOrders' is your table name, and
'OrderID' is the primary key field.
 
Works Great, Thanks for your help!

Brendan Reynolds said:
Complex? Nah! :-)

SELECT Year([OrderDate]) AS [Year], Month([OrderDate]) AS [Month],
Count(tblOrders.OrderID) AS CountOfOrderID
FROM tblOrders
GROUP BY Year([OrderDate]), Month([OrderDate]);

Where 'OrderDate' is your date field, 'tblOrders' is your table name, and
'OrderID' is the primary key field.

--
Brendan Reynolds (MVP)

Gregw said:
I have a database that we are currently using as order tracking. Each
order
gets entered on the day it was ordered, and we store an "Order Date" field
with each record. I am trying to come up with a querie that will give me
a
'running tally' (possibly as a pivot chart) on how many orders we took in
each month (from when we started through the current month). Is there an
easy way to do this so that we can just re-run the report/querie everytime
we
want to look at this data? (I am guessing there is a way to do this,
however
it is beyond my scope of expertise). Any help would be greatly
appreciated.
 
Back
Top