...

View Full Version : Using time as condition in SQL



bostjank
12-03-2003, 07:57 AM
Hi!

I would like to retrieve records of news that were published between PM 1:00 and PM 3:00.
How can I form an SQL query that would check the given time interval?

Thanks,
Bostjan

glenngv
12-03-2003, 08:16 AM
Try:

SELECT * FROM TableName WHERE [pubdate] BETWEEN #1:00 PM# and #3:00 PM#

or:

SELECT * FROM TableName WHERE pubdate BETWEEN '1:00 PM' and '3:00 PM'

where pubdate is a datetime field.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum