Multiple table JOIN???

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Multiple table JOIN???

Post by alex.barylski »

I am trying to LEFT JOIN multiple tables, two tables are data tables and one is a junction (association) table:

[sql]SELECTFROM    aquarius.rpi_procedure_sequences    INNER JOIN aquarius.rpi_procedures         ON (rpi_procedure_sequences.id_procedure = rpi_procedures.id_primary)    INNER JOIN aquarius.rpi_sequences         ON (rpi_procedure_sequences.id_sequence = rpi_sequences.id_primary);[/sql]

Am I missing an AND or what? I am getting an error in my MySQLYog control panel...
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM
aquarius.rpi_procedure_sequences
INNER JOIN aquarius.rpi_procedur' at line 2
Just curious...

Cheers,
Alex
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: Multiple table JOIN???

Post by VladSun »

SELECT * ;)
There are 10 types of people in this world, those who understand binary and those who don't
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Multiple table JOIN???

Post by Eran »

yep, need to specify columns :)
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: Multiple table JOIN???

Post by alex.barylski »

Haha...ooops I can't believe I missed that. :D

Anyways, thank you, I think I finally just cliqued with JOIN's and finally get their prupose. Joining tables, duh! All this time I joined tables in the WHERE clause which is horribly inefficient. :P

Cheers,
Alex
Post Reply