MySQL 4.14 on FC4
I have a database for a soccer team; simplified:
Roster
- serial (bigint)
- name (varchar)
goals
- serial (bigint)
- gameNumber (bigint) // for linking to a schedule
- playerSerial (bigint) // for linking to Roster
assists
- serial (bigint)
- gameNumber (bigint) // for linking to a schedule
- playerSerial (bigint) // for linking to Roster
I can get a count of goals (or assists) separately, thus:
SELECT COUNT(goals.serial) AS myGoals, Roster.name
FROM goals LEFT JOIN Roster ON goals.playerSerial = Roster.serial
GROUP BY Roster.name
ORDER BY myGoals DESC, Roster.name
How can I get both goals and assists (and, presumably, points = goals +
assists) in the same query?
--
Joe Makowiec
http://makowiec.org/
Email: http://makowiec.org/contact/?Joe