我正在进行两个查询的联合。
查询单独运行时没有问题,但联合会抛出此查询。有任何想法吗?
查询
SELECT CStr([REFERENCE])AS CostID,CSng([RATE])AS HRates FROM [Qry 1项目预算pt1人工费率] UNION ALL SELECT CStr([REFERENCE]),CSng([Rate])FROM [Qry 1 Project Budget pt2 3rd party];
访问2007
答案 0 :(得分:1)
CStr()
和CSng()
都会在Null中引发错误。检查您的[REFERENCE]
和[RATE]
值是否为空。
SELECT
[REFERENCE],
[RATE]
FROM [Qry 1 Project Budget pt1 labour rates]
WHERE [REFERENCE] Is Null OR [RATE] Is Null
UNION ALL
SELECT
[REFERENCE],
[Rate]
FROM [Qry 1 Project Budget pt2 3rd party]
WHERE [REFERENCE] Is Null OR [RATE] Is Null;