SQL Query to Display Highest Amount Grater Than Rs 50000 Charged in the Resort.
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.
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
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 totalpaid. 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