i***@gmail.com
2012-08-22 09:41:30 UTC
RouteId SeatNumber DateofBooking StartPoint EndPoint
1 11 11/08/2012 1 2
1 15 11/08/2012 2 4
1 20 11/08/2012 4 8
1 40 11/08/2012 1 9
For a given routeid and date I would like to write stored procedure to get seatnumber which is already booked. The parameters are @RouteId, @DateofBooking, @StartPoint, @EndPoint.
For example if @RouteId=1 and @dateofbooking= 11/08/2012, @startpoint=2 and @endpoint=4 then SeatNumber 15 and 40 will show as booked. However SeatNumber 11and 20 will be available. This is because SeatNumber 15 is already booked for the same start and end points. Also SeatNumber 40 is booked for journey where startpoint<@startpoint and endpoint>@endpoint.
1 11 11/08/2012 1 2
1 15 11/08/2012 2 4
1 20 11/08/2012 4 8
1 40 11/08/2012 1 9
For a given routeid and date I would like to write stored procedure to get seatnumber which is already booked. The parameters are @RouteId, @DateofBooking, @StartPoint, @EndPoint.
For example if @RouteId=1 and @dateofbooking= 11/08/2012, @startpoint=2 and @endpoint=4 then SeatNumber 15 and 40 will show as booked. However SeatNumber 11and 20 will be available. This is because SeatNumber 15 is already booked for the same start and end points. Also SeatNumber 40 is booked for journey where startpoint<@startpoint and endpoint>@endpoint.