* =James Birkholz= > In a message dated 1/12/02 10:48:45 AM Central Standard Time, > [EMAIL PROTECTED] writes: > ---snip--- > << SELECT A.Name, B.Name, P.ID > FROM Persons P > LEFT JOIN QualityA A USING(A_ID) > LEFT JOIN QualityB B USING(B_ID) > WHERE P.ID = thatGuy; >> > ---snip--- > > That doesn't work, get an error as it tries to find B_ID in the A table.
Sorry, my bad. USING() depends on the table immediately preceeding it. Try this: SELECT A.Name, B.Name, P.ID FROM Persons P LEFT JOIN QualityA A ON A.A_ID=P.A_ID LEFT JOIN QualityB B ON B.B_ID=P.B_ID WHERE P.ID = 1; > I tried swapping the partners on the first LEFT JOIN... > > SELECT A.Name, B.Name, P.ID > FROM QualityA A > LEFT JOIN Persons P USING(A_ID) > LEFT JOIN QualityB B USING(B_ID) > WHERE P.ID = thatGuy > > but that gives me more strange results > (using my example IDs:) > > Name Name Researcher > "A Quality" "AQuality" thatGuy > "B Quality" "B Quality" thatGuy If the above does not help, post the output of "desc Persons", "desc QualityA", "desc QualityB" and "select * ..." from the same three tables. -- Roger --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php