SUM & COUNT Functions are duplicating records in calculation

G

Guest

I have a table of approx. 128K records. These records contain an account#,
date of service, & charges. I have written a query for this table to provide
a count of all accounts after a specific date and sum the charges; by month
and year. The query will successfully run, yet the total "count" of accounts
(Sum of January to December) is greater than the total records in the
original table. The query appears to duplicate a count. I would like to know
what caused this issue and to stop duplicating the "TOTAL" Functions for both
Sum and Count commands.
 
G

Guest

Here is the SQL
SELECT [0507 - CONTRACTUAL TEST - IP].[Prim F/C], Count([0507 - CONTRACTUAL
TEST - IP].[Curr F/C]) AS [CountOfCurr F/C], Sum([0507 - CONTRACTUAL TEST -
IP].TotChgs) AS SumOfTotChgs, Sum([0507 - CONTRACTUAL TEST - IP].InsPmt) AS
SumOfInsPmt
FROM [0507 - CONTRACTUAL TEST - IP]
WHERE ((([0507 - CONTRACTUAL TEST - IP].DschDt)>#7/18/2006#))
GROUP BY [0507 - CONTRACTUAL TEST - IP].[Prim F/C]
HAVING ((([0507 - CONTRACTUAL TEST - IP].[Prim F/C])="CM"));
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top