CREATE VIEW dbo.RoomTypeOverbookingView AS
SELECT dtRange.IndividualDate AS View_DateStamp, MAX(Id) AS View_Id, FK_RoomTypeNumber AS View_FK_RoomTypeNumber
FROM RoomTypeOverbooking WITH (NOLOCK) 
CROSS APPLY dbo.DateRange(RoomTypeOverbooking.StartDate, RoomTypeOverbooking.EndDate, 0) AS dtRange
GROUP BY dtRange.IndividualDate, FK_RoomTypeNumber