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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

comparing dates

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I am trying to compare dates. I want to pull out all records that fall within a given month and year. For example: Say I want to pull out all records for 3/02(March of 2002). How can I get it to ignore the day part of the date? This is for an "event search" so I have start dates and end dates for each event. I want to be able to search for all events happening in a certain month. I have tried using cast with wildcards in the day part of the date but it doesn't like that.

This is something like I need but it doesn't work:
SELECT *
FROM EVENTTABLE
WHERE CAST('month/*/year' AS DATE) BETWEEN STARTDATE AND ENDDATE

Any help is greatly appreciated!

Thanks
 
for march 2002

SELECT *
FROM EVENTTABLE
WHERE STARTDATE between '2/28/2002' AND '4/1/2002'

or

SELECT *
FROM EVENTTABLE
WHERE STARTDATE = '3/2/2002' S. van Els
SAvanEls@cq-link.sr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top