繁体   English   中英

错误的参数数量SQL MSACCESS

[英]Wrong number of arguments SQL MSACCESS

运行以下查询时出现错误,指示错误的参数数量:

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;

Exp需要一个参数,您需要两个。

旧版: EXP(population_postcodes.longitude- target_postcodes.longitude, 2)

新增内容: (population_postcodes.longitude- target_postcodes.longitude)*(population_postcodes.longitude- target_postcodes.longitude)

尝试更换...

EXP(<expression>, 2)

...至...

<expression>^2

在Access中,EXP函数将e(自然对数的底数)返回为幂。 要将表达式提升为幂,请使用^运算符。

根据您的情况,请小心在表达式两边加上方括号,例如...

(population_postcodes.longitude- target_postcodes.longitude)^2

...强制使用最后的电源。 默认情况下,^运算符在-运算符之前进行求值。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM