August 20, 2009 at 1:01 am
Hi,
Need some help on the query,I have some problem writing a query for starttime falling between a range
select * from table where starttime between @starttime and @endtime
if here @starttime=20/08/2009 5:00:00.000 and @endtime=20/08/2009 10:00:00.000
by applying above start and endtime i also get the records from which start after 10:00:00.000
for example i get returned records whose start time is 20/08/2009 10:00:00
to resolve this i have used the below but i think this is not better way to do
select * from table where starttime between @starttime and @starttime and
endtime between @endtime and @endtime
Please help with this
Thanks
August 20, 2009 at 1:13 am
between does greater than or equal to and less than or equal to , so from what you've said ,"returned records whose start time is 20/08/2009 10:00:00", SQL seems to be returning the right data.
Can you provide a script that emulates your issue ?
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply