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

Date comparison

Status
Not open for further replies.

jack1971

Programmer
May 23, 2002
14
CA
Hi,

I am using JDBC to do query from Access 2000. If I need data on some specific day, say,24/05/02, or between 01/01/02 and 24/05/02, how to put "WHERE" clause?

And I have converted string to java.sql.Date.

Thanks!

Jack
 
Jack,

SELECT
Field1, Field2
FROM
tblMyTable
WHERE
MyDateField BETWEEN #2002-15-02# AND #2002-04-07#

will return all recs with MyDateField between February 15, 2002 and July 4, 2002. I recommend the ANSI format YYYY-MM-DD for dates when you can.

HTH,
Jeff Burgess
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top