On Wed, 2003-06-11 at 13:48, Ville Mattila wrote:
> Hello,
> 
> I have two tables, other having information of cottages and other including
> information when each cottage is booked. The table structures are following:
> 
> Cottages:
> - code
> - name
> - equipment
> 
> Reservations:
> - cottagecode
> - begindate
> - enddate
> 
> I'm looking for a query structure that I can use to find for example
> cottages that are free on 15. - 16. July. Any help?
> 
Hi,

Something like:

select c.* from cottage c
left join reservations r
on r.cottagecode = c.code 
and begindate <= '2003-07-16' and enddate >= '2003-07-15'
where r.cottagecode is null

regards,
Martin


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to