Aug 13, 2020 3:43 pm
Write a query to display the guest id and guest name who has charged the highest amount in the resort. sort the output on the guest id.
2 Replies
Aug 22, 2020 4:29 am
Hello,
Try the below query and let me know.
Select GuestID, name
from Guest
Where
Guest.GuestID IN(Select GuestID from Booking where totalcharge=select max(totalcharge)
from Booking Group by GuestId)
Order By guestID desc
Jun 01, 2021 6:41 am
Display guest details who paid total charges rs.50000 and above. write a query to fetch guest id, guest name, and the sum of total charges. give alias name to total charges as total paid. sort the result by guest id.
Select
GuestID,
GuestName,
SUM(Total_Charges) as TotalPaid
From
Guest
Group By GuestID, GuestName
Having SUM(Total_Charges)>= 50000
Order GuestID DESC