我想运行这个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