Posted by Steve on 10/26/06 13:51
| SELECT r.Room ,
| r.Description
| FROM rooms r ,
| (
| SELECT Room
| COUNT(*) Availability
| FROM bookings
| WHERE Reserved >= ' . $startDate . '
| AND Reserved <= ' . $endDate . '
| GROUP BY Room
| ) b
| WHERE b.Room = r.Room
| AND b.Availability = 0
|
check that! that wouldn't give you what you're expecting...this should:
SELECT Room ,
Description
FROM rooms
WHERE Room NOT IN
(
SELECT Room
FROM bookings
WHERE Reserved >= ' . $startDate . '
AND Reserved <= ' . $endDate . '
)
much better. ;^)
Navigation:
[Reply to this message]
|