Try using aliases: SELECT SCHEDULE.DATE_TIME, HOME_TEAM.TEAM as HomeTeamName, AWAY_TEAM.TEAM as AwayTeamName FROM SCHEDULE LEFT JOIN TEAMS HOME_TEAM ON SCHEDULE.HOME_TEAMID=HOME_TEAM.PRIMARYKEY LEFT JOIN TEAMS AWAY_TEAM ON SCHEDULE.AWAY_TEAMID=AWAY_TEAM.PRIMARYKEY
On Wed, Oct 24, 2012 at 1:42 PM, Jeff <jeff_j_dun...@yahoo.com> wrote: > ** > > > The following simple query produces the results below: > > SELECT SCHEDULE.DATE_TIME, TEAMS.TEAM FROM SCHEDULE > LEFT JOIN TEAMS ON SCHEDULE.HOME_TEAMID=TEAMS.PRIMARYKEY > > ***QUERY RESULTS (Showing 'Home Team' Column)*** > 12/01/2012 TeamA > 12/21/2012 TeamB > 12/25/2012 TeamC > > How do I include the corresponding 'Away Team' column? Please see tables > below: > > ***SCHEDULE TABLE*** > PRIMARYKEY HOME_TEAMID AWAY_TEAMID DATE_TIME > 1 1 2 12/01/2012 > 2 2 3 12/21/2012 > 3 3 1 12/25/2012 > > ***TEAMS TABLE*** > PRIMARYKEY TEAM_NAME > 1 TeamA > 2 TeamB > 3 TeamC > > Please advise, thank you! > > > [Non-text portions of this message have been removed] ------------------------------------ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Visit http://www.firebirdsql.org and click the Resources item on the main (top) menu. Try Knowledgebase and FAQ links ! Also search the knowledgebases at http://www.ibphoenix.com ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/firebird-support/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/firebird-support/join (Yahoo! ID required) <*> To change settings via email: firebird-support-dig...@yahoogroups.com firebird-support-fullfeatu...@yahoogroups.com <*> To unsubscribe from this group, send an email to: firebird-support-unsubscr...@yahoogroups.com <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/