Hi to all, I am developing a booking system .I have problem to get records . Scenario is. I have a database table where i define two fields arrival_date and departure_date. I have a calendar when i move to month beneath the calendar i am showing all records of that month. My query is SELECT * FROM `roombooking` WHERE arrival_date between '2010-05-01' and '2010-05-31' or departure_date between '2010-05-01' and '2010-05-31' it show me all records whose arrival_date or departure_date is between '2010-05-01' and '2010-05-31' For example if a person book a room with arrival_date is '2010-05-01' and departure date is '2010-06-01' this records should also come in month of may because month of may is between june and july . kindly help me
Essentially you're loading all arrivals and departures for the month of May, correct? SELECT * FROM `roombooking` WHERE (arrival_date>= '2010-5-1' AND arrival_date<='2010-5-31') OR (departure_date>='2010-5-1' AND departure_date<='2010-5-31') That will work.
check these MySql Qurey select * from 'roombooking'' where (arrival_date>= And arrival_date<=) or (departure_date>='' And departure_date<='') Add date and check these query and tell me