You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
select p.id, p.title, COALESCE(r.reserved_tickets,0) from plays p left join (select sum(number_of_tickets) as reserved_tickets,play_id from reservations group by play_id) r on p.id = r.play_id order by r.reserved_tickets desc, p.id;