Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with returning summary results with count query

Status
Not open for further replies.

Roy33

Technical User
May 29, 2001
21
US
I am trying to design a query to do the following:

I have an access database that track orders. tbl_orders has a list of all the orders. The table has the order ID, date, the day, and the type of order. E.g:

500 12/12/2003 FRI software
501 12/12/2003 FRI hardware
502 12/12/2003 FRI hardware
503 12/13/2003 SAT electronics
504 12/13/2003 SAT hardware
505 12/14/2003 SUM software
I have a query that summaries the number of orders as follows -- call it query_summary


12/12/2003 3
12/13/2003 2
12/13/2003 1

I am trying to have a query that will summarize the total number of orders for a specfici month. E.g

November 15
December 6

Currently I am writing queries that query queries and I'm hoping there is a faster way than this:

1) query1 - returns the above summary data query, summary_query
2) query2 - performs a count of the number of orders column above (e.g. 3+2+1 = 7).

Is there a way to make a crosstab (or other) query to do this:

November 15
December 7

I can do it now but it takes many queries on top of queries.
Any suggestions -- or is there a good guide to crosstab queries?

Thanks in advance!
David W
 
[tt]select format(orderdate,'MMMM')
, count(*)
from yourtable
group
by format(orderdate,'MMMM')[/tt]

rudy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top