I am working on a web application where you can reserve a conference room. Let me first explain to you what my database looks like.
I have a table Reservationswith the following design
ID --> int
ROOMID --> int
DATE_BEGIN --> DATETIME
DATE_END --> DATETIME
I also have a table ROOMwith the following design
ID --> int
NAME --> VARCHAR(30)
Now inserting a row in the table reservationlooks like this:
ID --> 1
ROOMID --> 2
DATE_BEGIN --> 2012-01-01 12:02:33
DATE_END --> 2012-01-01 14:00:00
Now, what I'm doing, I entered the start date and end date. And when I click the button, for example. Check availabilityit returns all room names that are available for a given date range.
Now I have this query:
SELECT zaa.NAME
FROM ARTICLES_ZAAL zaa
INNER JOIN ARTICLES_RESERVERING res
ON zaa.ID =res.ZAALID
WHERE res.DATUM_BEGIN <> @DATUM_BEGIN
AND res_DATUM_EINDE <> @DATUM_EINDE
I know that there is still a lot, but the problem is that. I do all this in a function called by a web service.
Can anyone help?
Sincerely.