Ex.คอนเซป --> "select คนขับ from table where วันจองล่วงหน้า not between วันเริ่ม(ค้นหา) and วันสิ้นสุด(ค้นหา)"
คอนเซปนี้จะได้ คนขับ ที่ไม่ถูกจอง ในช่วงวันที่ค้นหาน่ะครับ
WHERE ('{$new_start}' NOT BETWEEN book_start AND book_end) AND ('{$new_end}' NOT BETWEEN book_start AND book_end) AND (book_start NOT BETWEEN '{$new_start}' AND '{$new_end}') AND (book_end NOT BETWEEN '{$new_start}' AND '{$new_end}')
WHERE worker_id = {$worker_id} AND book_start > DATE(NOW()) AND ('{$new_start}' NOT BETWEEN book_start AND book_end) AND ('{$new_end}' NOT BETWEEN book_start AND book_end) AND (book_start NOT BETWEEN '{$new_start}' AND '{$new_end}') AND (book_end NOT BETWEEN '{$new_start}' AND '{$new_end}')
WHERE worker_id = {$worker_id} AND ('{$new_start}' NOT BETWEEN book_start AND book_end) AND ('{$new_end}' NOT BETWEEN book_start AND book_end) AND (book_start NOT BETWEEN '{$new_start}' AND '{$new_end}') AND (book_end NOT BETWEEN '{$new_start}' AND '{$new_end}')