Subject Re: [firebird-support] Re: Solution for a redundant join?
Author Ann Harrison
On Wed, Oct 24, 2012 at 4:34 PM, Jeff <jeff_j_dunlap@...> wrote:

>
> > Use tables aliases to include multiple references to a single table.
> >
> >
> > SELECT
> > SCHEDULE.DATE_TIME, HomeTeam.TEAM, AwayTeam.Team
> > FROM SCHEDULE
> > LEFT JOIN TEAMS HomeTeam ON HomeTeam.PRIMARYKEY = SCHEDULE.HOME_TEAMID
> > LEFT JOIN TEAMS AwayTeam ON AwayTeam.PRIMARYKEY = SCHEDULE.AWAY_TEAMID
>
> Sean, aliases did the trick, thank you kindly!
>
>
Just out of curiosity, do you have any schedule records for which there are
not matching home teams and away teams? If not, I would use two inner
joins rather than two outer joins. That lets the optimizer do a better job
of planning the execution path.

Good luck,

Ann


[Non-text portions of this message have been removed]