我有以下功能查询来在 Access 中创建交叉表/数据透视表
TRANSFORM Sum(y.TNAV) AS TNAV
SELECT y.RecDate
FROM BNYDaily AS y
WHERE (((y.AccName) In ("A","B")) AND y.RecDate >= DateValue("1/1/2013"))
GROUP BY y.RecDate
PIVOT y.AccName; )
问题是查询返回的结果包含NULL
混淆了我的计算的字段。我想省略此交叉表中NULL
在任一列中具有值的行:
RecDate A B
....
1/25/2013 1,469,004,032.00 968.63
1/26/2013 1,466,082,304.00
1/28/2013 973.91
1/29/2013 1,471,277,440.00 971.66
...
我尝试了以下查询,该查询将上述查询用作子查询,但没有任何运气:
SELECT * FROM
(
TRANSFORM Sum(y.TNAV) AS TNAV
SELECT y.RecDate
FROM BNYDaily AS y
WHERE (((y.AccName) In ("A","B")) AND y.RecDate >= DateValue("1/1/2013"))
GROUP BY y.RecDate
PIVOT y.AccName;
) AS t
WHERE t.A IS NOT NULL AND t.B is NOT NULL
奇怪的是,它不在 Access 中运行并返回错误。如果我从交叉表查询作为保存的查询表进行查询,它可以工作。有任何想法吗?