I have 3 tables (note this may not be the best sql db design)
Room: TypeName, RoomNumber
RoomType: TypeName, ...
Reservation: StartDate, EndDate, TypeName, RoomNumber
My input parameters are startdate
and enddate
. I'd like to know the distinct roomtypes
available. From my understanding the solution goes like this: AvailableRoomTypes = AllRoomTypes - UnavailableRoomTypes
Obviously AllRoomTypes
can be found by: SELECT DISTINCT(TypeName) FROM Room;
and I know how to get unavailable rooms, but not unavailable roomtypes
. Nor do I know how to subtract one set from another. I can get a set of all rooms+roomtypes
and another set of unavailable rooms+roomtypes
but how do I join them such that it is A-B
? Maybe some sort of NOT_CONTAINS
function?
I'd like my output parameters to be SELECT * FROM RoomType (for the appropriate roomtypes)
.