Filter data with INNER JOIN - MYSQL

0

Good afternoon, I'm new to the group and wanted to know where I'm going wrong ...

I have a search on the database as well

**

SELECT * FROM Users INNER JOIN naturezanegocio ON Users.emaillogin = naturezanegocio.emaillogin
AND Users.paisorigem = '1'
AND Users.cidade = 'são paulo'
AND Users.estado = 'SP'
AND Users.numfuncionario > '0' < '10'
AND Users.registro = 'sim'
AND Users.investimento = 'sim'
AND Users.interesseparceria = 'sim'
AND Users.niveis_acesso_id = '0'
AND naturezanegocio.natureza IN ('2', '0', '0')
INNER JOIN tecnologia ON tecnologia.tecnologia IN ('5', '0', '0')

**

I need to return only the user who has all these requests, but it does not filter everything at once, but table by table that ends up returning me invalid users for not meeting all requirements ...

Where did I go wrong?

    
asked by anonymous 07.06.2018 / 18:13

3 answers

0

Apparently it's a syntax error

  

Correct syntax:

SELECT column_name(s)
FROM table1
INNER JOIN table2 ON table1.column_name = table2.column_name;

SOURCE: www.w3schools.com/sql/sql_join_inner

    
07.06.2018 / 18:46
0

Try this, I think it will help you

SELECT 
    *
FROM
    Users
        INNER JOIN
    naturezanegocio ON Users.emaillogin = naturezanegocio.emaillogin
        INNER JOIN
    tecnologia ON tecnologia.tecnologia = (Algum Identificador que Possua na tabela Users para fazer referencia)
WHERE
            Users.paisorigem = '1'
        AND Users.cidade = 'são paulo'
        AND Users.estado = 'SP'
        AND Users.numfuncionario > '0' < '10'
        AND Users.registro = 'sim'
        AND Users.investimento = 'sim'
        AND Users.interesseparceria = 'sim'
        AND Users.niveis_acesso_id = '0'
        AND naturezanegocio.natureza IN ('2' , '0', '0')
        and tecnologia.tecnologia IN ('5', '0', '0')
    
07.06.2018 / 18:57
0

Solution

SELECT 
    *
FROM
    Users
        INNER JOIN
    naturezanegocio ON Users.emaillogin = naturezanegocio.emaillogin
        INNER JOIN
    tecnologia ON tecnologia.emaillogin = Users.emaillogin
WHERE
            Users.paisorigem = '1'
        AND Users.cidade = 'são paulo'
        AND Users.estado = 'SP'
        AND Users.numfuncionario > '0' < '10'
        AND Users.registro = 'sim'
        AND Users.investimento = 'sim'
        AND Users.interesseparceria = 'sim'
        AND Users.niveis_acesso_id = '0'
        AND naturezanegocio.natureza IN ('2' , '5', '0')
        and tecnologia.tecnologia IN ('5', '6', '0')
        group by Users.emaillogin
    
07.06.2018 / 20:00