By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,504 Members | 1,212 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,504 IT Pros & Developers. It's quick & easy.

HELP! Query Ambiguous Outer Joins

P: n/a
I'm trying to pull all the parents of a particular animal and I have my SQL
statement that says not supported and when I attempt to run the Query, I get

The SQL statement couldn't be executed because it contains ambiguous outer
joins. To force one of the joins to perform first, create a separate query that
performs the first join and then include and then include that query in your
SQL statement.

Here is the Code:
SELECT tblAnimal.AnimalID, tblAnimal.Sire, tblAnimal.Dam
FROM tblAnimal AS DamDamDam, ((tblAnimal LEFT JOIN ((((((tblAnimal AS Sire LEFT
JOIN tblAnimal AS SireSire ON Sire.Sire = SireSire.AnimalID) LEFT JOIN
tblAnimal AS SireDam ON Sire.Dam = SireDam.AnimalID) LEFT JOIN tblAnimal AS
SireSireSire ON SireSire.Sire = SireSireSire.AnimalID) LEFT JOIN tblAnimal AS
SireSireDam ON SireSire.Dam = SireSireDam.AnimalID) LEFT JOIN tblAnimal AS
SireDamSire ON SireDam.Sire = SireDamSire.AnimalID) LEFT JOIN tblAnimal AS
SireDamDam ON SireDam.Dam = SireDamDam.AnimalID) ON tblAnimal.Sire =
Sire.AnimalID) LEFT JOIN ((((tblAnimal AS Dam LEFT JOIN tblAnimal AS DamSire ON
Dam.Sire = DamSire.AnimalID) LEFT JOIN tblAnimal AS DamDam ON Dam.Dam =
DamDam.AnimalID) LEFT JOIN tblAnimal AS DamSireSire ON DamSire.Sire =
DamSireSire.AnimalID) LEFT JOIN tblAnimal AS DamDamSire ON DamDam.Sire =
DamDamSire.AnimalID) ON tblAnimal.Dam = Dam.AnimalID) INNER JOIN tblAnimal AS
DamSireDam ON DamSire.Dam = DamSireDam.AnimalID;

Michael
Nov 12 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Answer is in the message.
Break it down into simple steps
Do step 1 in a query. Then use that query and tblanimal in query 2 to do step 2
and so on

HTH
David B

Lumpierbritches <lu*************@aol.com> wrote in message
news:20***************************@mb-m07.aol.com...
I'm trying to pull all the parents of a particular animal and I have my SQL
statement that says not supported and when I attempt to run the Query, I get

The SQL statement couldn't be executed because it contains ambiguous outer
joins. To force one of the joins to perform first, create a separate query that performs the first join and then include and then include that query in your
SQL statement.

Here is the Code:
SELECT tblAnimal.AnimalID, tblAnimal.Sire, tblAnimal.Dam
FROM tblAnimal AS DamDamDam, ((tblAnimal LEFT JOIN ((((((tblAnimal AS Sire LEFT JOIN tblAnimal AS SireSire ON Sire.Sire = SireSire.AnimalID) LEFT JOIN
tblAnimal AS SireDam ON Sire.Dam = SireDam.AnimalID) LEFT JOIN tblAnimal AS
SireSireSire ON SireSire.Sire = SireSireSire.AnimalID) LEFT JOIN tblAnimal AS
SireSireDam ON SireSire.Dam = SireSireDam.AnimalID) LEFT JOIN tblAnimal AS
SireDamSire ON SireDam.Sire = SireDamSire.AnimalID) LEFT JOIN tblAnimal AS
SireDamDam ON SireDam.Dam = SireDamDam.AnimalID) ON tblAnimal.Sire =
Sire.AnimalID) LEFT JOIN ((((tblAnimal AS Dam LEFT JOIN tblAnimal AS DamSire ON Dam.Sire = DamSire.AnimalID) LEFT JOIN tblAnimal AS DamDam ON Dam.Dam =
DamDam.AnimalID) LEFT JOIN tblAnimal AS DamSireSire ON DamSire.Sire =
DamSireSire.AnimalID) LEFT JOIN tblAnimal AS DamDamSire ON DamDam.Sire =
DamDamSire.AnimalID) ON tblAnimal.Dam = Dam.AnimalID) INNER JOIN tblAnimal AS
DamSireDam ON DamSire.Dam = DamSireDam.AnimalID;

Michael


Nov 12 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.