我有这个查询:
SELECT v2.longitude AS something FROM points AS v2
现在我想做这样的事情:
SELECT v2.longitude AS something,2*something FROM points AS v2
但它失败了
points.longitude
是一个浮点数
我怎样才能解决这个问题?
编辑-这是当前查询的示例:
$query="
SELECT
v2.longitude AS xa,
v2.latitude AS ya,
v3.longitude AS xb,
v3.latitude AS yb,
(yb-ya)/(xb-xa) AS l,
-1/l AS l_katheto,
(l*xa-l_katheto*$tetmimenh+ya-y1)/(l_katheto-l) AS x_tomh,
l*(x_tomh-xa)+ya AS y_katheto,
min(
sqrt(
(v2.longitude-$tetmimenh)*
(v2.longitude-$tetmimenh)+
(v2.latitude-$tetagmenh)*
(v2.latitude-$tetagmenh)
),
sqrt(
(v3.longitude-$tetmimenh)*
(v3.longitude-$tetmimenh)+
(v3.latitude-$tetagmenh)*
(v3.latitude-$tetagmenh)
),
sqrt(
($tetmimenh-x_tomh)*
($tetmimenh-x_tomh)+
($tetagmenh-y_tomh)*
($tetagmenh-y_tomh)
)
)
FROM
segments AS v1
JOIN points AS v2 ON v1.from_point=v2.point_id
JOIN points AS v3 ON v3.point_id=v1.to_point";