SELECT * FROM `log` WHERE status= '1' and booking_id in(SELECT id FROM booking WHERE (`checkin` BETWEEN '$start_date' and '$end_date' or checkout BETWEEN '$start_date' and '$end_date' ) )
คือผมจะ ORDER BY checkin คือวันที่เช็คอินใน ตาราง booking จะทำยังไงครับ
SELECT * FROM log a
LEFT JOIN booking b
ON a.booking_id = b.id
WHERE a.status= '1'
AND (b.checkin BETWEEN '$start_date' and '$end_date' or b.checkout BETWEEN '$start_date' and '$end_date' )
ORDER BY b.checkin