我使用我的MySQL數據庫這一行:SQL USE INDEX語法錯誤
SELECT * FROM `dump` USE INDEX `time_desc` WHERE (`nodeId`=10047 AND `time`<=1377040709 AND `valid`=1) ORDER BY `time` DESC LIMIT 1;
我想不通爲什麼,但數據庫返回以下錯誤:
[Error: ER_PARSE_ERROR: 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 'time_desc WHERE
nodeId
=10048 ANDtime
<=1377040709 ANDvalid
=1 ORDER BY `ti' at line 1]
任何想法,因爲我該如何解決這個問題?
http://dev.mysql.com/doc/refman/5.1/en/index-hints.html你需要在'parens'(time_desc)中附上'time_desc'' –