Complex Querie

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.
 
B

Brendan Reynolds

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.
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top