James McConnell wrote:


On 4/8/04 9:18 AM, "Barry ." <[EMAIL PROTECTED]> wrote:


Hi

I recently began to work through the Book entitled PHP & MySQL For Dummies
and i am currently stuck towards the end of the forth chapter ive done
everything as said so in the book but i keep getting an error message.  Here
is an outline of the problem:

i have 2 tables one pet containing petName and petType other table is color
containgin petName and petColor. The code which i keep getting errors on is:

Select * from pet outer join color using (pet.petName=petcolor.petName) ;

Now Ive posted my problem on several forums on the internet and have a wide
range to replys suggesting what to do but nothing seems to work.

Can anyone please help me??

Barry Smith

I think the reason that's not working is because that doesn't look like MySQL syntax for a join statement. From the MySQL documentation, try this:

SELECT * FROM pet OUTER JOIN color ON pet.petName=petColor,petName;

Keep in mind this will only return rows in pet that have corresponding rows
in color.  I hope that's what you're looking for.

The above code is not tested, but that's the proper JOIN syntax in MySQL.
Going through the documentation, I don't see a USING keyword anywhere.  That
looks suspiciously like Oracle code.

Hope that help!

USING is documented in the manual <http://www.mysql.com/doc/en/JOIN.html>. USING expects a list of columns which exist in both tables. The following are quivalent:


  SELECT * FROM pet JOIN color ON pet.petName = color.petName;
  SELECT * FROM pet JOIN color USING (petName);

Michael


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to