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

Writing a query statement for dates

Status
Not open for further replies.

shenlingstyle

Electrical
Joined
Oct 5, 2005
Messages
8
Location
CA
Hi, I'm a beginner in writing SQL statements.

Well basically I have a database with a date field. The data shows up like "11/23/2003 1:11:00 AM". The field is called START_DATE.

How can I write a query statement to extract all records that refer to tomorrow, December 15th, 2005?

Thanks all any help,

Colin
 
It depends what features your SQL engine has. This is an example which works on Firebird SQL engine:

select START_DATE from <your table> where CAST(START_DATE as DATE)=CURRENT_DATE+1

Here CURRENT_DATE is a function which return the current date from computer.
 
Many SQL dialects have a Between operator which is useful foe handling Dates and DateTime values

Good Luck
johnwm
________________________________________________________
To get the best from these forums read faq731-376 before posting

Steam Engine enthusiasts:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top