Why is this sql giving tables with minimum
field having null. Also when A
has no data between the given date ranges, it is providing the table with all rooms
having minimum
as null
SELECT `rooms`.*,A.`minimum`
FROM (
SELECT `room_id`, min(`available_rooms`) AS `minimum`
FROM `room_bookings`
WHERE `date` BETWEEN '2014-02-01' and '2014-02-10'
GROUP BY `room_id`) as A
INNER JOIN `rooms` on `rooms`.`room_id`=A.`room_id`
WHERE `rooms`.`location`='kathmandu'
AND `rooms`.`status`=1
AND A.`minimum`!=NULL