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

Return a range of dates

Status
Not open for further replies.

SelbyGlenn

Technical User
Oct 7, 2002
444
GB
Hi there,

I'm very new to SQL...

I need to query a set of data and return only fields where the date falls between 2006-01-01 and 2006-12-12. How do I do this?

Thanks in advance,

Glenn
BEng MCSE CCA
 
WHERE Year(yourDateField)=2006

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks PHV, that did the trick

Glenn
BEng MCSE CCA
 
If your end-date is really December 12 (not December 31) then you need
Code:
WHERE yourDateField BETWEEN '2006-01-01' AND '2006-12-12'
 
Oops! Typo. It should indeed be 2006-12-31

Glenn
BEng MCSE CCA
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top