Hi
this query returns the following data(all the conflicting bookings) vongrunt and jonwolds helped me
to write this query now i need to extend this query..
returns this data
can we be able to Group each conflicting date range together
that means i wanted to print output like this
thanks for any help
this query returns the following data(all the conflicting bookings) vongrunt and jonwolds helped me
to write this query now i need to extend this query..
Code:
select B1.BookingId,B1.start,B1.Finish
from Bookings B1
where exists (
select BookingId from Bookings B2
where B1.Bookingid <> B2.Bookingid and B1.start <= B2.finish and B1.finish >= B2.start AND B2.ResourceID = B1.ResourceID
)
and B1.start >='20041011' and B1.Finish <= '20041018'
and B1.ResourceId in(select ResourceId from viewItems where viewId=711)
Group by B1.BookingId,B1.start,b1.Finish
order by B1.start
returns this data
Code:
BookingId Start Finish
1052450720 2004-10-11 08:00 2004-10-11 17:30
1052450718 2004-10-11 09:00 2004-10-11 14:30
1052450721 2004-10-11 10:00 2004-10-11 18:00
1052450723 2004-10-11 18:00 2004-10-11 18:30
1052450727 2004-10-11 18:00 2004-10-11 18:30
1052450722 2004-10-13 09:00 2004-10-13 17:30
1052450724 2004-10-13 10:00 2004-10-13 12:30
1052450725 2004-10-13 17:30 2004-10-13 18:00
1052450735 2004-10-16 09:00 2004-10-16 10:30
1052450736 2004-10-16 09:00 2004-10-16 10:30
that means i wanted to print output like this
Code:
BookingId Start Finish GroupId
1052450720 2004-10-11 08:00 2004-10-11 17:30 1
1052450718 2004-10-11 09:00 2004-10-11 14:30 1
1052450721 2004-10-11 10:00 2004-10-11 18:00 1
1052450723 2004-10-11 18:00 2004-10-11 18:30 2
1052450727 2004-10-11 18:00 2004-10-11 18:30 2
1052450722 2004-10-13 09:00 2004-10-13 17:30 3
1052450724 2004-10-13 10:00 2004-10-13 12:30 3
1052450725 2004-10-13 17:30 2004-10-13 18:00 3
1052450735 2004-10-16 09:00 2004-10-16 10:30 4
1052450736 2004-10-16 09:00 2004-10-16 10:30 4