<filename>SQL/Exams practice/Databases MSSQL Server Exam - 16 Apr 2019/Flight Profits.sql<gh_stars>0
  SELECT f.Id AS FlightId,
		 SUM(t.Price) AS Price
    FROM Flights f
    JOIN Tickets t
	  ON t.FlightId = f.Id
GROUP BY f.Id
ORDER BY Price DESC, FlightId
