I have this code and it gives me sold seats summarized for each movie:
SELECT mName, SUM(soldSeats)
FROM movie, show, prog
WHERE movie.movieID = prog.movieID
AND prog.showID = show.showID
GROUP BY mName
The problem is to find movie that have the max of seats sold, I have tried to add this, but only get no rows:
HAVING SUM(soldseats) = (SELECT MAX(SUM(soldseats)) FROM show
GROUP BY solgteplasser)
Do anyone have a suggestion? Here is how the tables looks: Sum of a activity