Query error when using 1 where and 2 joins in Query Search

-1

Hello, I'm running the following query in mysql:

select * from usuarios where login='gamboamurilo' or email='[email protected]' and senha='8b0a60f71e758c8b27e7688ee754cd85' 
inner join permissoes on usuarios.permissoes=permissoes.id 
inner join dados_perfil on usuarios.id=dados_perfil.id_usuario;

However, it is returning a syntax error, but even after reading the documentation, I could not find such an error, where it is and how can I fix it?

    
asked by anonymous 17.09.2018 / 02:01

1 answer

2

The INNER JOIN should appear before the WHERE clauses.

I would mount this query with the following structure:

select *
  from usuarios 
 inner join permissoes on usuarios.permissoes=permissoes.id 
 inner join dados_perfil on usuarios.id=dados_perfil.id_usuario
 where (usuarios.login='gamboamurilo'
        or usuarios.email='[email protected]')
   and usuarios.senha='8b0a60f71e758c8b27e7688ee754cd85';
    
17.09.2018 / 02:15