当我运行以下查询时,我收到一个错误,指出错误的参数数量:
SELECT
population_postcodes.*,
target_postcodes.*,
SQR( EXP(population_postcodes.longitude- target_postcodes.longitude, 2) + EXP(population_postcodes.latitude-target_postcodes.latitude, 2) ) as distance
FROM population_postcodes INNER JOIN target_postcodes on Population_postcodes.Population_postcode = Target_postcodes.Target_postcode;
有人可以建议我如何解决这个问题吗?
我也尝试过以下代码:
SELECT Population_postcodes.*, Target_postcodes.*
FROM population_postcodes
INNER JOIN target_postcodes
ON Population_postcodes.Population_postcode = Target_postcodes.Target_postcode
SQR( (population_postcodes.longitude- target_postcodes.longitude)^2 + (population_postcodes.latitude-target_postcodes.latitude)^2 ) as distance;
这段代码:
SELECT Population_postcodes.*, Target_postcodes.*, SQR( (population_postcodes.longitude- target_postcodes.longitude)^2 + (population_postcodes.latitude-target_postcodes.latitude)^2 ) as distance
FROM population_postcodes
INNER JOIN target_postcodes
ON Population_postcodes.Population_postcode = Target_postcodes.Target_postcode;
答案 0 :(得分:0)
Exp需要一个参数,你给两个。
旧:EXP(population_postcodes.longitude- target_postcodes.longitude, 2)
新:(population_postcodes.longitude- target_postcodes.longitude)*(population_postcodes.longitude- target_postcodes.longitude)
答案 1 :(得分:0)
尝试替换......
EXP(<expression>, 2)
...到...
<expression>^2
在Access中,EXP函数返回e(自然对数的基数)上升到幂。要将表达式提升为幂,请使用^运算符。
在您的情况下,请小心将括号括在表达式周围,例如......
(population_postcodes.longitude- target_postcodes.longitude)^2
...强制最后施加电源。默认情况下,^运算符在 - 运算符之前计算。