Results 1 to 5 of 5
Thread: mysql: SUM/ MAX query
Mar 15, 2011, 20:20 #1
- Join Date
- Mar 2011
- 0 Post(s)
- 0 Thread(s)
mysql: SUM/ MAX query
I am very new to this and having problems with the SUM and MAX in my query:
SELECT Score.performerId, Performer.performerName, Performer.countrycode, Country.countryName, Event.eventName, Score.points
FROM Score, Performer, Country, Event
WHERE points = (SELECT MAX(points) FROM Score WHERE roundName = 'Final') AND roundName = 'Final'
The tables look like this:
Performer (performerID, performerName, countryCode)
Assessor (assessorID, aName, countryCode)
Event (eventID, eventName)
Round (eventID, roundName, roundDate, roundTime)
Score (eventId, roundName, performerID, assessorId, points)
PerformerEvent (performerID, eventID)
There are five assessors in the Final stage and the query is supposed to show the winner of the competition- the person who got the highest scores as a sum of the 5 scores in the final round. There are 2 finalists. I don't really know what to do with the SUM function- where it belongs. The MAX statement is incorrect.
Also, just realised that the name of the event is missing from my script- it is supposed to be eventName = 'Piano'.
I will greatly appreciate any help.