Hi, I need to query all values between specified date range and time range. For example, I want to query all the values from 5:00Pm on 16-Sep-2010 to 9:00AM 21-Sep-2010. Any ideas how the query should be.
Thanx in advance.
Hi, I need to query all values between specified date range and time range. For example, I want to query all the values from 5:00Pm on 16-Sep-2010 to 9:00AM 21-Sep-2010. Any ideas how the query should be.
Thanx in advance.
SELECT * FROM TABLE
WHERE DATE BETWEEN '09/16/2010 05:00:00' and '09/21/2010 09:00:00'
How about this?
SELECT Value, ReadTime, ReadDate
FROM YOURTABLE
WHERE CAST(ReadDate AS DATETIME) + ReadTime BETWEEN '2010-09-16 17:00:00' AND '2010-09-21 09:00:00'
EDIT: output according to OP's wishes ;-)
Infact this worked for me
SELECT *
FROM myTable
WHERE CAST(ReadDate AS DATETIME) + ReadTime BETWEEN '2010-09-16 5:00PM' AND '2010-09-21 9:00AM'