Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT H.Name AS HotelName,
- SUM(R.Price * DATEDIFF(DAY, B.ArrivalDate, B.DepartureDate)) AS TotalRevenue
- FROM Bookings AS B
- INNER JOIN Hotels AS H ON B.HotelId = H.Id
- INNER JOIN Rooms AS R ON B.RoomId = R.Id
- GROUP BY H.Name
- ORDER BY TotalRevenue DESC;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement