Board index » delphi » date querys

date querys

Hello!

How must be constructed a query with date fields in the where section?

For example: SELECT * FROM Users WHERE LastUpdate = '12/21/01 12:50:04' <-
It's wrong

Thanks

 

Re:date querys


Quote
In article <3ad97c46_1@dnews>, David Sancho wrote:
> How must be constructed a query with date fields in the where section?

> For example: SELECT * FROM Users WHERE LastUpdate = '12/21/01 12:50:04' <-
> It's wrong

If you have dates but no time then i use

select * from users where lastupdate = '12-jan-2001';

If you have dates with times then I  use:

select * from users where lastupdate >= '12-jan-2001' and lastupdate <
'13-jan-2001'

hth

Robert Schieck (TeamB)
MER Systems Inc.
Inprise/Borland/InterBase Search Engine http://www.mers.com/searchsite.html

Other Threads