我想運行這個sql語句,但我得到一個錯誤,是什麼問題?我有一個名爲'zips'的表格來獲取所有符合條件的數據,我想要做的是鑄造LAT
,LONG
從zips
表格,它們是varchar
類型。SQL語法錯誤#1064
SELECT * FROM zips
WHERE (
CAST(LAT AS FLOAT) <= 41.009707145195
AND CAST(LAT AS FLOAT) >= 40.286092854805
AND CAST(LONG AS FLOAT) <= -73.307544588345
AND CAST(LONG AS FLOAT) >= -74.266455411655)
AND (
CAST(LAT AS FLOAT) != 40.6479
AND CAST(LONG AS FLOAT) != -73.787
)
)
,誤差
#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 'FLOAT) <= 41.009707145195 AND CAST(LAT AS FLOAT) >=
40.286092854805 AND CAST(LON' at line 1
您至少有一個,也許是兩個括號問題 – 2015-04-01 20:46:00
請更多解釋! @JohnConde – user3003810 2015-04-01 20:49:44
LONG也是一個保留字http://dev.mysql.com/doc/refman/5.6/en/reserved-words.html。在英語中有足夠多的單詞,您永遠不需要爲數據庫對象使用resrved字。 – 2015-04-01 20:50:54