I want to check if a certain room is available between a start and end date. I am doing this with a webservice function. This function gives back a list with all the reservation
AND
has higher precedence than OR
.
Change the last line to:
AND (res.DATUM_BEGIN >= @DATUM_EINDE OR res.DATUM_EINDE <= @DATUM_BEGIN)
SELECT * FROM ARTICLES_RESERVERING res
INNER JOIN ARTICLES_ZAAL roo ON res.ZAALID = roo.ID
WHERE roo.ID = @ZAALID
AND @DATUM_EINDE between res.DATUM_BEGIN and res.DATUM_EINDE
I will rather use this query as using OR is generally expensive.