我目前正在ACCESS中编写查询。但是,结果具有NULL值的行。以下是我的代码:
SELECT
DISTINCT A.pcode AS [Product Type],
Sum([footage]*[lb_ft]*12) AS TotalWeightUsed,
Sum(A.totlength) AS TotalLength,
Count(A.pcode) AS NumberOfPieces,
A.date_
FROM A
GROUP BY A.pcode, A.date_
HAVING (((A.date_)=#4/16/2014#)) and A.pcode IS NOT NULL;
有一行值为NULL的A.pcode。我尝试过“Distinct”和“A.pcode IS NOT NULL”,但它们无法消除NULL值行。我是Access的新手。我想知道我能做些什么。
答案 0 :(得分:1)
我猜这应该有效。您不应该需要 DISTINCT 限定符:
SELECT
A.pcode AS [Product Type],
Sum([footage]*[lb_ft]*12) AS TotalWeightUsed,
Sum(A.totlength) AS TotalLength,
Count(A.pcode) AS NumberOfPieces,
A.date_
FROM A
WHERE
A.date_ = #4/16/2014#
AND A.pcode IS NOT NULL
GROUP BY
A.pcode,
A.date_;