$sql = "SELECT r.room_id,r.roomtype_id,r.status as status,d.check_in as check_in, d.check_out as check_out FROM room r,roomdetail d where r.room_id=d.room_id and r.roomtype_id = '$roomtype_id' and NOT(d.check_in <='$check_out' AND d.check_out >='$check_in')order by r.room_id asc";
$sql="select * from room where status='1' and roomtype_id='$roomtype_id'";
SELECT R.ROOM_ID,R.ROOMTYPE_ID,R.STATUS AS STATUS,D.CHECK_IN AS CHECK_IN, D.CHECK_OUT AS CHECK_OUT
FROM ROOM R,ROOMDETAIL D
WHERE R.ROOM_ID=D.ROOM_ID
AND R.ROOMTYPE_ID = '$ROOMTYPE_ID'
AND (NOT(D.CHECK_IN <='$CHECK_OUT' AND D.CHECK_OUT >='$CHECK_IN') OR ( R.STATUS='1'))
ORDER BY R.ROOM_ID ASC
$sql="SELECT r.room_id,r.roomtype_id,r.status AS status,d.check_in AS check_in, d.check_out AS check_out FROM room r,roomdetail d WHERE r.status='1' AND r.roomtype_id = '$roomtype_id' or( r.room_id=d.room_id AND (NOT(d.check_in <='$check_out' AND d.check_out >='$check_in')))ORDER BY r.room_id ASC ";
$sql="SELECT r.room_id,r.roomtype_id,r.status FROM room r,roomdetail d WHERE r.status='1' and r.roomtype_id = '$roomtype_id' or( r.room_id=d.room_id AND r.roomtype_id = '$roomtype_id' AND (NOT(d.check_in <='$check_out' AND d.check_out >='$check_in')))Group by r.room_id having r.room_id>1 ";