I have two tables, one for openings and one for orders. The entry in the reservation table always refers to the opening, and for each opening there can be several orders. I would like to extract all holes that have orders other than bookingType 'C'.
eg.
if the opening has 3 orders of type A, B and C, it should NOT be displayed as a result
if the opening has only orders of type A and B, it should be displayed in Result
The following is what I tried, but this is not true as it is not suitable for example 1:
select op.id, bo.id
from opening op
left join booking bo on bo.openingId = op.id
where bo.bookingType != 'C';
Here is the complete timestamp query:
select op.id, bo.id
from opening op
left join booking bo on bo.openingId = op.id
where ((bo.arrivalDate < '2009/06/20' AND bo.departureDate <= '2009/06/20') OR
(bo.arrivalDate >= '2009/06/27' AND bo.departureDate > '2009/06/27'))
, bookingType, , arrivalDate departureDate: , 20th June 2009 27th June 2009.
Frankie