Jump to content


Photo

INNER JOIN


  • Please log in to reply
1 reply to this topic

#1 Darkness Soul

Darkness Soul
  • Members
  • PipPipPip
  • Advanced Member
  • 133 posts
  • LocationBrazil; São Paulo.

Posted 26 April 2006 - 06:22 PM

Hi Guys,

Well, mysql is not my speciality, so, what I'm done wrong?

D.Soul

Error:
#1064 - 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 'ON
tbCatalogo_Produtos.id_subdepartamento = tbCatalogo_Subdepa
Code:
SELECT
    tbCatalogo_Produtos.id
    AS
        id,
    tbCatalogo_Produtos.titulo
    AS
        titulo
FROM
    tbCatalogo_Departamentos
    INNER JOIN
    (
        tbCatalogo_Subdepartamentos
        INNER JOIN
        (
            tbCatalogo_Produtos
            ON
                tbCatalogo_Produtos.id_subdepartamento = tbCatalogo_Subdepartamentos.id
        )
        ON
            tbCatalogo_Subdepartamentos.id_departamento = tbCatalogo_Departamentos.id
    )
    ON
        tbCatalogo_Departamentos.id = 2
WHERE
    tbCatalogo_Subdepartamentos.id = 5

(If something is wrong, please tell me. I'm learning this language. Thank you)

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 27 April 2006 - 03:19 AM

This is probably a scoping issue.... what's with all the parentheses?
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users