Guest who paid highest charges in SQL

Guest who paid highest charges

 Write a query to display the guestid and guest name who was charged highest amount in the resort. Sort the output on the guestid.

Guest who paid highest charges

select g.guestid, g.name
from guest g left join booking b
               on b.guestid=g.guestid
               where b.totalcharge=(select max(totalcharge) from booking)
   order by 1;

Related:

Leave a Comment

two × two =