Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear Experts,

I have a table with three columns, Room No, CheckIn and CheckOut Dates. For example Room No is 200, CheckIn Date is 2014-07-09 and CheckOut Date is 2014-07-12. This is a hotel management project for my IT degree in 2nd Year.

My concern is, I want to check RoomNo 200 is booked on 2014-07-10?, what is the query to find out that using MySQL? Please help me? (If CheckIn and CheckOut Date is 2014-07-09 or Date is 2014-07-12, I can check it using query, but between 2014-07-09 to 2014-07-12, how can I check?)

Thanks!
Posted

1 solution

Say, you date is 2014-07-10,
SQL
SELECT * FROM tablename
WHERE '2014-07-10' between checkindate and checkoutdate
 
Share this answer
 
Comments
abdulsafran 24-Jul-14 5:03am    
Thank you very much Peter Leow!!!!!
Peter Leow 24-Jul-14 6:08am    
You are welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900