It may just be MySQL being stupid, yet again.
One thing that might help is to convert some of those inner queries into VIEWs and then join the views.
For example:
Code:
CREATE VIEW v1 AS
SELECT rTeamID, SUM( IF(wld='w', 2, IF(wld='d', 1, 0 ) ) ) AS wintotal
FROM results
GROUP BY rTeamID;
CREATE VIEW v2 AS
SELECT iTeamID FROM individResults WHERE fa='f'
UNION ALL
SELECT iTeamID FROM individResultsDoubles WHERE fa='f';
CREATE VIEW v3 AS
SELECT iTeamID, COUNT(*) AS individualWins
FROM v2
GROUP BY iTeamID;
CREATE VIEW allresults AS
SELECT * FROM v1 INNER JOIN v3 ON v1.rTeamID = v3.iTeamID;
SELECT team.TeamID, team.teamName, allresults.wintotal, allresults.individualWins
FROM team LEFT JOIN allResults ON team.TeamID = allresults.rTeamID
ORDER BY allresults.wintotal, allresults.individualWins
(You can and should use better view names than just v1, v2, v3.)
IF you do that, then you can test each view independently first:
Code:
SELECT * FROM v1;
SELECT * FROM v2;
SELECT * FROM v3;
SELECT * FROM allresults;
If they all look good, then the final query should be fine.