Query Help...

T

TBoe

In my table I have a Date_Out and a Date_In field to record dates. I'm
trying to build a query to sum both fields but be able to do it by dates.
ie. I want to see the quantity of transactions from 1/1/06 to 3/01/06. I
have queries for each Date_Out and Date_In by date separately, but is there a
way to combine them and see the total within a date range? Thanks for your
help.
 
M

MH

SELECT COUNT(MyField) as Total
FROM MyTable
WHERE Date_Out between 1/1/06 and 3/1/06 or Date_In between 1/1/06 and
3/1/06;

MH
 
T

TBoe

Thanks for the quick response MH. So, if I want the total from both fields
(Date_In and Date_Out), would I insert that into (Myfield)? If so, is there
a seperator in between? ( , ; . ). Also, if I wanted to choose the date
range myself, would I insert the text bracets in the "Where" statement where
the dates are now?
Here's what I want to acheive.

Date Out Date In
1/02/06
01/06/06
02/08/06 02/10/06
02/15/06
02/20/06 02/25/06

If I were to selet the number of transactions between 01/01/06 and 01/30/06,
the results would be "2" If I chose the dates, between 02/01/06 and 02/28/06,
the results would be 5. I want to be able to do this monthly and yearly.
I'm not sure if I'm making much sense but again, thanks much for your help.
 

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