gpt4 book ai didi

mysql - SQL 查询错误 #1064

转载 作者:行者123 更新时间:2023-11-29 05:31:15 24 4
gpt4 key购买 nike

所以我有这个查询:

SELECT 
t1.password
FROM Session AS t1
INNER JOIN Locations AS t2 ON
t2.id = t1.location_id AND
SQRT( POWER( CONVERT(t2.longitude,float(10)) - 132.456, 2) +
POWER( CONVERT(t2.latitude,float(10)) - 132.456, 2) ) < 100
WHERE t1.end_distribution = 0 AND t1.end_session = 0

我明白了:

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(10)) - 132.456, 2) + POWER( CONVERT(t2.latitude,float(10)) - 132.456, 2) )' at line 13

最佳答案

使用

CONVERT(t2.longitude, float(10))

MySQL CONVERT SYNTAX

更新

根据上面的文档,您不能将表达式转换为浮点类型,而是使用小数。

CONVERT(t2.longitude, decimal(10))

关于mysql - SQL 查询错误 #1064,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14490409/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com