OH YEAH, BITCHES.

May 29, 2006 16:55

SELECT Home.TeamName, Home.Score, Away.TeamName, Away.Score FROM (SELECT GameID, TeamName, Score FROM (SELECT GameID, TeamName, Team.TeamID FROM Team INNER JOIN (SELECT QueryA.GameID, TeamID from Sides INNER JOIN (SELECT DISTINCT Sides.GameID FROM Sides INNER JOIN Game USING(GameID) WHERE Round = 1) QueryA USING(GameID) WHERE IsHome = TRUE) QueryB USING(TeamID)) QueryD INNER JOIN (SELECT Score, TeamID FROM Sides INNER JOIN (SELECT DISTINCT Sides.GameID FROM Sides INNER JOIN Game USING(GameID) WHERE Round = 1) QueryC USING(GameID) WHERE IsHome = TRUE) QueryE USING(TeamID)) Home INNER JOIN (SELECT GameID, TeamName, Score FROM (SELECT GameID, TeamName, Team.TeamID FROM Team INNER JOIN (SELECT QueryA.GameID, TeamID from Sides INNER JOIN (SELECT DISTINCT Sides.GameID FROM Sides INNER JOIN Game USING(GameID) WHERE Round = 1) QueryA USING(GameID) WHERE IsHome = FALSE) QueryB USING(TeamID)) QueryD INNER JOIN (SELECT Score, TeamID FROM Sides INNER JOIN (SELECT DISTINCT Sides.GameID FROM Sides INNER JOIN Game USING(GameID) WHERE Round = 1) QueryC USING(GameID) WHERE IsHome = FALSE) QueryE USING(TeamID)) Away USING(GameID);
Previous post Next post
Up