我是使用 Access 并尝试更改此查询的新手:
SELECT
DateDiff("d", [Invoice]![TxnDate],[ReceivePaymentLine]![TxnDate]) AS ActualPaymentDays,
IIF ([ActualPaymentDays] < 90, 0.10, IIF ([ActualPaymentDays] < 120, 0.09, IID ([ActualPaymentDays] , 365, 0.05, 0))) AS PayPerValue
FROM
ReceivePaymentLine
INNER JOIN
Invoice ON ReceivePaymentLine.AppliedToTxnTxnID = Invoice.TxnID
我制作“ActualPaymentDaysRate”表:
ActualPaymentDay1
PayPerValue1
ActualPaymentDay2
PayPerValue2
ActualPaymentDay3
PayPerValue3
我将上面的查询更改为以下查询:
SELECT
DateDiff("d",[Invoice]![TxnDate],[ReceivePaymentLine]![TxnDate]) AS ActualPaymentDays,
IIF ([ActualPaymentDays] < [ActualPaymentDaysRate.ActualPaymentDay1],[ActualPaymentDaysRate.PayPerValue1], IIF ([ActualPaymentDays] < [ActualPaymentDaysRate.ActualPaymentDay2], [ActualPaymentDaysRate.PayPerValue2], IIF ([ActualPaymentDays] < [ActualPaymentDaysRate.ActualPaymentDay3],[ActualPaymentDaysRate.PayPerValue3], 0))) AS PayPerValue
FROM
ActualPaymentDaysRate, ReceivePaymentLine
INNER JOIN
Invoice ON ReceivePaymentLine.AppliedToTxnTxnID = Invoice.TxnID
它显示错误“不支持 JOIN 表达式”。