Hi avdhut_s,
Yes. I think there was a problem with original query. However, I had been using the same type of logic as suggested by Peso. And, I was able to figure out where the problem was. There's basically four cases that you have to check for:
1. Where the Start Time for a request is less than a reservation time and the End Time is greater than the reservation start time:
WHERE RequestStart < DB_Res_Start AND RequestEnd > DB_Res_Start
2. Where the Start Time for a request is les than a reservation end time and the End Time for the request is greater than the reservation end time.
AND RequestStart < DB_Res_End AND RequestEnd > DB_Res_End
3. Where the Start Time and the End Time for a request are both within a reservation time.
4. Where the Start Time for a request is less than and reservation and the End Time for the request is greater than the reservation end time.
End Time for the request is greater than a reservation start time and the
I think everyone here is trying to help you think this thing out for yourself. I've given you almost the whole query. If you can't figure it out, post your best query here. You're almost there. If it was any more complicated I would just go ahead and post the whole query. But its really not that difficult. You must be very close by now.
|