错误的参数数量SQL MSACCESS [英] Wrong number of arguments SQL MSACCESS

查看:63
本文介绍了错误的参数数量SQL MSACCESS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我运行以下查询时,我收到一条错误消息,指示错误的参数数量:

I am getting an error indicating the wrong number of arguments when I run the following query:

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;

有人可以建议我如何解决此问题吗?

Could anyone please suggest how I can fix this?

我还尝试了以下代码:

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(<expression>, 2)

...到...

<expression>^2

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

In Access, the EXP function returns e (the base of natural logarithms) raised to a power. To raise an expression to a power, use the ^ operator.

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

In your case, be careful to put brackets around the expression, for example...

(population_postcodes.longitude- target_postcodes.longitude)^2

...强制最后施加电源.默认情况下,^运算符在-运算符之前进行评估.

...to force the power to be applied last. By default, the ^ operator is evaluated before the - operator.

这篇关于错误的参数数量SQL MSACCESS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆