Matt Greatorex
Registered User.
- Local time
- Today, 16:33
- Joined
- Jun 22, 2005
- Messages
- 1,019
I've been using the following query:
While all monthly and yearly values were positive, the query produced exactly the results expected (i.e. one row of data for each Grouping Name/Month combination, containing the overall totals for each field).
Now, however, some Grouping Names have minus values and the query is showing an extra row (one for positive values, one for negative). It's as if having one or more minus values is being treated as a new Grouping Name/Month combination.
Is Sum() the correct method to use, when dealing with negative values, or should I be using some other function?
Code:
SELECT
[qry_1].Month,
B_Division_Group.Grouping_Name,
Sum([qry_1].Month_Client_Count_from_B) AS Monthly_Count,
Sum([qry_1].Month_Assets_from_B) AS Monthly_Total,
Sum([qry_1].YTD_Client_Count_from_B) AS Yearly_Count,
Sum([qry_1].YTD_Assets_from_B) AS Yearly_Total
FROM
([qry_1] INNER JOIN tbl_branch
ON [qry_1].BranchCode = tbl_branch.BranchID)
INNER JOIN B_Division_Group
ON tbl_branch.BranchName = BDivision_Group.N_Br
GROUP BY
[qry_1].Month,
B_Division_Group.Grouping_Name;
Now, however, some Grouping Names have minus values and the query is showing an extra row (one for positive values, one for negative). It's as if having one or more minus values is being treated as a new Grouping Name/Month combination.
Is Sum() the correct method to use, when dealing with negative values, or should I be using some other function?