Sql query (stored procedure based on the timings)

Posted by Samanthajyesta under Sql Server on 11/8/2011 | Points: 10 | Views : 903 | Status : [Member] | Replies : 2
Hi

write a query for booking a car,which is already booked between 3am to 5am and 8am to 10am.so when the customer wants that car to book between 6am to 10am,then it should display as booked

http://www.dotnetfunda.com


Responses

Posted by: Blessyjees on: 11/8/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi,

Could you provide your table structure. For this you can write a select query with where condition start time between start and end time OR endtime between starttime and endtime. If you will get 0 records, you can insert data otherwise no

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

Samanthajyesta, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: RohiK on: 11/8/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,

If i consider bookingTime in your column name of bookedCar table then the query will be

select * from bookedCar where bookingTime not in between '6:00' to'10:00'

Happy Programming!!
Rohi

Samanthajyesta, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response