$sql = "SELECT * FROM room WHERE room_id NOT IN ((SELECT room_id FROM reserve_description WHERE ('$check_in' BETWEEN checkin_date AND checkout_date)AND('$check_out' BETWEEN checkin_date AND checkout_date)) AND (SELECT room_id FROM check_in_and_out WHERE ('$check_in' BETWEEN check_in_date AND check_out_date)AND ('$check_out' BETWEEN check_in_date AND check_out_date)))";
ผมต้องการให้มันเชื่อมกันในส่วน
((SELECT room_id FROM reserve_description WHERE ('$check_in' BETWEEN checkin_date AND checkout_date)AND('$check_out' BETWEEN checkin_date AND checkout_date)
และ (SELECT room_id FROM check_in_and_out WHERE ('$check_in' BETWEEN check_in_date AND check_out_date)AND ('$check_out' BETWEEN check_in_date AND check_out_date)))"; เขียนให้มันเชื่อมกันซึ่งทำไม่ถูกนะคับ
$strSQL = "SELECT * FROM reserve_description LEFT JOIN check_in_and_out
ON reserve_description.room_id = check_in_and_out.room_id
WHERE ('$check_in' BETWEEN checkin_date AND checkout_date)
AND('$check_out' BETWEEN checkin_date AND checkout_date)";