CREATE PROCEDURE dbo.OnlineFindRoomtypesByResource  @ACountryNumber INT, @AHotelNumber  INT, @AResourceNumber INT AS
SET NOCOUNT ON
/*
    Created by Troels Buch Nov 2008
    
    Changes: 	
	TB20090224: Changed parameternames
	TB20081203: Added IsNull

    NOTES: 	- 
*/


SELECT * FROM OnlineRoomTypes WITH (nolock) 
INNER JOIN OnlineRoomTypesTranslated WITH (NOLOCK) ON OnlineRoomTypes.OnlineRoomTypeNumber = OnlineRoomTypesTranslated.OnlineRoomTypeNumber 
inner JOIN rooms WITH (nolock) on rooms.roomtypenumber = OnlineRoomTypes.roomtypenumber 
INNER JOIN RoomTypes ON OnlineRoomTypes.RoomTypeNumber = RoomTypes.RoomTypeNumber
WHERE (CountryNumber = @ACountryNumber ) AND IsNull(ResourcetypeNumber, 0 ) = @AResourceNumber AND OnlineRoomTypes.OnlineRoomTypeNumber IN (SELECT Roomtypes.OnlineRoomTypenumber 
FROM Onlineroomtypes WITH (NOLOCK) INNER JOIN Roomtypes WITH (NOLOCK) ON Onlineroomtypes.Onlineroomtypenumber = Roomtypes.onlineroomtypenumber 
WHERE IsNull(Roomtypes.Hotelnumber, 0) = @AHotelNumber) ORDER BY number


