December 2, 2009 at 10:06 pm
Hi
Try this
SET @FromTIME ='2009-12-01 13:01:00'
SET @ToTime = '2009-12-01 13:59:00'
select @a= min(FTIME),@b=max(TTIME) from @TEMP
select @a,@b,@FromTIME,@ToTime
select case
when cast(@FromTIME as datetime) BETWEEN @a AND @b-2
or cast(@ToTime as datetime) BETWEEN @a AND @b-2
then 'already'
else 'can'
end
It is not coming in MIN ,MAX
Since this is not in the Table i can able to enter so CAN should Return But Yours it is saying ALREADY
Thanks
Parthi
December 3, 2009 at 2:17 am
parthi-1705 (12/2/2009)
HiTry this
...
It is not coming in MIN ,MAX
Since this is not in the Table i can able to enter so CAN should Return But Yours it is saying ALREADY
Your statement is incorrect.
The values you provided are within the table range as requested earlier.
"It is not coming in MIN,MAX is false, too, since I get the MIN and MAX value when running it.
Now we're back to the very basics:
Clearly define your requirement (describing the business case, not simply posting source code), get sample data including expected result that actually support your requirement.
What you're doing at the mopment is throwing samples at us and as soon as you get an answer that meets your previous requirement you come up with a new example where it fails.
Like stated before:
Sit back and think about what you really need. Then describe it.
Your last example contradicts your previous requirement:
lies between the Temp table Range
It seems like that there is more than just a language barrier...
If you are looking for time slots that are not already "booked", then search this site for it and you'll find various solutions covering it.
Also, please keep in mind that we all are volunteers trying to help you. Starting a reply with "Try this" followed by some sample code seems not really like the way a question should be raised...
Viewing 2 posts - 16 through 16 (of 16 total)
You must be logged in to reply to this topic. Login to reply