2012-01-27 3 views
2

MySQL запрос является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 

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

ответ

3

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

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

Thanks Asaph it work –