Поле MySQL 'option' не работает - PullRequest
2 голосов
/ 27 января 2012

MySQL запрос

 SELECT option as value, name as text from jos_components where parent  = 0 and enabled=1 order by name

У меня есть таблица jos_components с именем поля option. Я хочу выполнить запрос выше, но он выдает ошибку.

#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 'option as value, name as text from jos_components where parent   = 0 and enabled=1' at line 1 

В чем проблема?

1 Ответ

3 голосов
/ 27 января 2012

option является зарезервированным словом MySQL .Вы должны будете окружить его обратными чертами в вашем запросе.Попробуйте это:

SELECT `option` as value, name as text from jos_components where parent  = 0 and enabled=1 order by name
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...