MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:Harald Fuchs Date:January 16 2003 9:11am
Subject:Re: three table join
View as plain text  
In article
"Tab Alleman" <Tab.Alleman@stripped> writes:

> Table1.PK = Table2.FK1
> Table3.PK = Table2.FK2

> My last effort looks something like:

> SELECT SomeStuff
> FROM Table1 AS T1
> LEFT JOIN Table2 AS T2 ON T1.PK = T2.FK1
> RIGHT JOIN Table3 AS T3 ON T2.FK2 = T3.PK
> WHERE T1.PK=999

> I want it to return 1 row, but it's returning as many rows as there are
> in Table3.  Where am I goofing?

Since the only constraint on Table3 occurs in a RIGHT JOIN condition,
MySQL must return all rows.

[Filter fodder: SQL query]
three table joinJosh L Bernardini15 Jan
  • Re: three table joinMichael T. Babcock15 Jan
  • Re: three table joinBrent Baisley15 Jan
RE: three table joinTab Alleman15 Jan
  • Re: three table joinHarald Fuchs16 Jan
  • Re: three table joinMichael T. Babcock22 Jan
RE: three table joinDiana Soares15 Jan