I have two subqueries that result in a list of fixtures, and a list of teams that the user has admin privileges for.
I can doing this having to call the same (quite complicated) subquery twice for the list of teams, like this:
(SELECT hometeam, awayteam etc... ) as fixtures
LEFT JOIN (SELECT team_id, admin etc... ) as teams1 ON fixtures.hometeam = teams1.team_id
LEFT JOIN (SELECT team_id, admin etc... ) as teams2 ON fixtures.awayteam = teams2.team_id
Is there a way of doing it using an alias for the team list query without having to execute it twice?