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!

Date Query using SQL 1

Status
Not open for further replies.

cyberprof

Programmer
Jun 10, 2003
229
GB
I'm trying to query my Access database on my webiste to produce a report on data for a particular month. For example, how many people ordered so far this month, or how many people ordered last month.

Ideally I would like to say, show me all the data for August 2004, or all the data for July 2004, without having to worry about how many days are in each month, or whether its a leap year.

How do I write my SQL just to query a month. All I've done in the past is use the BETWEEN statement.

 
SELECT date_id
FROM Table1
where month(date_id) = 8
and year(date_id) = 2004;
 
Nice one, thanks very much.

I'd almost worked it out for myself.

Cheers

J
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top