maybe its too simple or maybe its too complicated, but I cant find any solution around this problem. Or maybe i just spent too much time looking at the screen trying to solve it, but now i am officially out of all clues.
Say I have a SQL Table like this...
id AideCode StartTime EndTime 60210172014-01-1307:00:002014-01-1319:00:00244210172014-01-1407:00:002014-01-1419:00:00468410172014-01-1508:00:002014-01-1608:00:00656910172014-01-1608:00:002014-01-1708:00:00840410172014-01-1708:00:002014-01-1808:00:00996810172014-01-1808:00:002014-01-1908:00:0060210182014-01-1303:00:002014-01-1313:00:0060210182014-01-1410:00:002014-01-1318:00:00
Now I want to find out if anyone is available on 2014-01-13 between 4am - 5 am, basiclly between '2014-01-13 04:00:00' and '2014-01-13 05:00:00', it should return 1017 because it is available between that time slot.
Also I want to find out if anyone is available on 2014-01-14 between 7am - 9 am, basiclly between '2014-01-14 07:00:00' and '2014-01-14 09:00:00', it should return 1018 because it is available between that time slot.
So what will be that magical sql query look like?
www.SaqibKhan.Com