Hi,
I am trying to fetch the datetime records between two datetimes.
For Example,My Exam Date is 2013-08-01 00:00:00.000,Exam start time is 10 AM and Exam End Time is 7 Pm and Room Number is 123 which is availablein the tblTest
ExamTime,,,, ExamStarttTime ,,, ExamEndTime,,,,, RoomNo
2013-08-01 00:00:00.000,,, 2013-08-01 10:00:00.000,,,, 2013-08-01 19:00:00.000 ,,,, 201
If I pass the startdate as '2013-08-01 13:00:00.000' and enddate as '2013-08-01 14:00:00.000' in the select query .It should give the results.
select * from tblTest
where ExamDate='8/1/2013'
and(ExamStarttTime between DateAdd(s,1,2013-08-01 13:00:00.000) and DateAdd(s,-1,2013-08-01 14:00:00.000)
or (ExamEndTimebetween DateAdd(s,1,2013-08-01 13:00:00.000) and DateAdd(s,-1,2013-08-01 14:00:00.000;)))
Any Thoughts?