一段时间以来,我有这个已经工作了一个月的 SQL 块:
SELECT
F.[BRANCH] AS REGION
, F.[ACCOUNT]
, F.[EFFECTIVE]
, F.[POLICY]
, F.[DESC2]
, F.[DESC4]
, F.[GROSS]
, F.[COMM]
, F.[GST ON COMM]
, F.[ENTRYDATE]
, I.[TYPE]
FROM (
(SELECT [POLP - Detailed Debtors Import].*
FROM [POLP - Detailed Debtors Import]
WHERE [POLP - Detailed Debtors Import].[EFFECTIVE] <= DateValue("30/05/2012")
AND [POLP - Detailed Debtors Import].[GROSS] >= 0
AND [POLP - Detailed Debtors Import].[DESC4] IN ('RNWL', 'NEWB', 'EP')
AND [POLP - Detailed Debtors Import].[DUEYR] = 2012) AS F
INNER JOIN (SELECT IPM_ACCTXREF.* FROM IPM_ACCTXREF
WHERE IPM_ACCTXREF.TYPE
IN (SELECT [Evolve - Account Types].[Account Types]
FROM [Evolve - Account Types])
) AS I ON F.[ACCOUNT] = I.[ACCOUNT]
)
LEFT JOIN (SELECT [POLP - Detailed Debtors Import].*
FROM [POLP - Detailed Debtors Import]
WHERE [POLP - Detailed Debtors Import].[DESC4] IN ('CS', 'CANC', 'JL')
) AS S ON F.[POLICY] = S.[POLICY]
WHERE S.[POLICY] IS NULL
然后我想对 DateValue 参数进行更改(就像将 5 更改为 6 一样简单)。
那么问题是我重复了三次“JOIN 操作中的语法错误”。单击它们中的每一个,查询然后显示结果表,但带有“#Name?” 填充在每个字段中。
不知道这里发生了什么......