2012-01-27 4 views
2

MySQLのクエリを動作していないことは、私は、テーブルのフィールド名optionを持つjos_componentsを持ってMySQLのフィールド「オプションが」

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

です。上記のクエリを実行したいが、それは私にエラーを与える。

#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

ありがとうございました –

関連する問題