Craig Boxall wrote: > so we have this working so far: > > SELECT item.* FROM item LEFT JOIN booking ON item.id=booking.item_id > WHERE ((booking.id IS NOT NULL) OR (booking.end_date < $start_date OR > booking.start_date > $end_date)) > > this will return all items that have either no bookings or they do > have bookings but the start and end dates of the timeframe we are > looking for do not intersect. > > You can use EXISTS or you can use the 'IN' clause WHERE booking.id IN (SELECT id FROM booking WHERE [outside of $start_date and $end_date])
Goodluck! Cheers, Stig --~--~---------~--~----~------------~-------~--~----~ NZ PHP Users Group: http://groups.google.com/group/nzphpug To post, send email to [email protected] To unsubscribe, send email to [email protected] -~----------~----~----~----~------~----~------~--~---
