Mysql version - 5.6

select * from users u left join privsroles pr on pr.id_priv = p.id_priv left join privs p left join roles r on u.id_role = 'pr.id_role' and u.id_role = 'r.id_role' where u.id_user = 2 

Such a request produces an error:

 Π£ вас ошибка Π² запросС. Π˜Π·ΡƒΡ‡ΠΈΡ‚Π΅ Π΄ΠΎΠΊΡƒΠΌΠ΅Π½Ρ‚Π°Ρ†ΠΈΡŽ ΠΏΠΎ ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅ΠΌΠΎΠΉ вСрсии MySQL Π½Π° ΠΏΡ€Π΅Π΄ΠΌΠ΅Ρ‚ ΠΊΠΎΡ€Ρ€Π΅ΠΊΡ‚Π½ΠΎΠ³ΠΎ синтаксиса ΠΎΠΊΠΎΠ»ΠΎ 'where u.id_user = 2 limit 0, 50' Π½Π° строкС 7 

How to fix?

  • Something I will not understand - limit 0, 50 present in your code? Where does it appear in the error message? - Valentyn Hruzytskyi
  • @ Valery Gruzitsky, the fact of the matter is that there is no limit in the code, but for some reason it gives an error. I use openserver - word
  • How do you submit a request to the DBMS? - Sergey Gornostaev
  • one
    Maybe there is just ";" not enough at the end, and error messages are often just misleading. - Nikolay Belyakov
  • one
    The error was in merging multiple tables. It was necessary after each left join to put the condition on - word

0