I am working on a web app where it's possible to make a reservation of a meeting room. Let me first explain you how my database looks like.
I have table Reservations
with the following design
ID --> int
ROOMID --> int
DATE_BEGIN --> DATETIME
DATE_END --> DATETIME
I have also a table ROOM
with the following design
ID --> int
NAME --> VARCHAR(30)
Now an insert of a row in the table reservation
looks 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 do is, I enter a begin date and an end date. And when I push a button e.g. Check availability
it gives back all the room names which are available for this given date range.
For 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 missing but the problem is what. I am doing all of this in a function which is called by a web service.
Could anybody help please ?
kind regards.