定義可能な日付範囲内の5つの異なるフィールドから問題コードを検索し、返された各問題コードの合計を取得しようとしています。以下の私のクエリは、各クエリによって返された各問題コードを合計しますが、あるクエリから別のクエリへの合計は追加しません。
SELECT CUSTRAC.PROBLEM_CO, Count(CUSTRAC.PROBLEM_CO) AS CountOfPROBLEM_CO1
FROM CUSTRAC
WHERE (((CUSTRAC.DATE_SHIPP) Between [Begin Date] And [End Date]))
GROUP BY CUSTRAC.PROBLEM_CO, ([custrac].[problem_co])
HAVING (((CUSTRAC.PROBLEM_CO)<>""));
Union SELECT CUSTRAC.PROB_2, Count(CUSTRAC.PROB_2) AS CountOfPROB_2
FROM CUSTRAC
WHERE (((CUSTRAC.DATE_SHIPP) Between [Begin Date] And [End Date]))
GROUP BY CUSTRAC.PROB_2, ([custrac].[prob_2])
HAVING (((CUSTRAC.PROB_2)<>""));
Union SELECT CUSTRAC.PROB_3, Count(CUSTRAC.PROB_3) AS CountofPROB_3
FROM CUSTRAC
WHERE (((CUSTRAC.DATE_SHIPP) Between [Begin Date] And [End Date]))
GROUP BY CUSTRAC.PROB_3, ([custrac].[prob_3])
HAVING (((CUSTRAC.PROB_3)<>""));
Union SELECT CUSTRAC.PROB_4, Count(CUSTRAC.PROB_4) AS CountofPROB_4
FROM CUSTRAC
WHERE (((CUSTRAC.DATE_SHIPP) Between [Begin Date] And [End Date]))
GROUP BY CUSTRAC.PROB_4, ([custrac].[prob_4])
HAVING (((CUSTRAC.PROB_4)<>""));
UNION SELECT CUSTRAC.PROB_5, Count(CUSTRAC.PROB_5) AS CountofPROB_5
FROM CUSTRAC
WHERE (((CUSTRAC.DATE_SHIPP) Between [Begin Date] And [End Date]))
GROUP BY CUSTRAC.PROB_5, ([custrac].[prob_5])
HAVING (((CUSTRAC.PROB_5)<>""));