小编典典

没有为所需参数提供值

sql

我正在尝试对访问数据库运行以下qry,但出现错误没有为所需参数提供值?

SELECT        ID, DateColumn, Less90, Between90180, Between180365, GreaterThan365, SUM(Less90) + SUM(Between90180) + SUM(Between180365) + SUM(GreaterThan365) 
                     AS Total, SUM(Between180365) / Total AS Expr1,
                         (SELECT        SUM(Between180365) / (SUM(Less90) + SUM(Between90180) + SUM(Between180365) + SUM(GreaterThan365))
                           FROM            tblHandpieceFaliuresAge T2
                           WHERE        T2.ID <= tblHandpieceFaliuresAge.ID) AS RunningSum
FROM            tblHandpieceFaliuresAge
GROUP BY ID, DateColumn, Less90, Between90180, Between180365, GreaterThan365

阅读 178

收藏
2021-03-17

共1个答案

小编典典

您没有正确键入一列,Access认为您正在尝试传递参数。

再次遍历您的字段名称,并确保已正确输入所有字段名称。

我相信问题可能是这样的:

SUM(Less90) + SUM(Between90180) + SUM(Between180365) + SUM(GreaterThan365) 
                 AS Total

然后,您稍后在Total这里引用它:

SUM(Between180365) / Total

Access不能使用别名并在查询中重新使用它,您需要这样做:

SUM(Between180365) / 
    (SUM(Less90) + SUM(Between90180) + SUM(Between180365) + SUM(GreaterThan365))

还要确保处理分母,以免被零除。

2021-03-17