2012-11-13 90 views
1

我想對varchar列做一個非常簡單的排序,並且出現語法錯誤。使用PHP和phpmyadmin進行測試。MySql - 無法對varchar列進行排序?

這是查詢:

SELECT * FROM cards_available_properties ORDER BY option 

這是錯誤:

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 LIMIT 0, 30' at line 1

回答

5

OPTION是保留關鍵字。反向逃避它。

SELECT * FROM cards_available_properties ORDER BY `option`