// Does not work
SELECT Performances.Date, Performances.MovieName, Performances.TheaterName, COUNT(Reservation.Number) as takenSeats, Theaters.Seats as totSeats
FROM Performances, Theaters
LEFT JOIN Reservation USING (PerfId)
WHERE Theaters.Name=Performances.TheaterName
GROUP BY Reservation.PerfId;
ERROR 1054 (42S22): Unknown column 'PerfId' in 'from clause'
// Works fine
SELECT Performances.Date, Performances.MovieName, Performances.TheaterName, COUNT(Reservation.Number) as takenSeats, Theaters.Seats as totSeats
FROM Performances
LEFT JOIN Reservation USING (PerfId)
LEFT JOIN Theaters ON Theaters.Name = Performances.TheaterName
GROUP BY Reservation.PerfId;