Different Outcomes between sum and non-sum in SQL

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am creating a SQL query for my report. The problem is when I sum the
transactions in SQL query, the total number comes out different from the
total number that I don't sum in SQL query.

Does anyone know why?

Thanks.
 
Please post your SQL statement and tell us how you are totaling the number
without the SQL.
 
Hi Karl,

Thanks Karl. I took the numbers (both sum and non-sum) from [Total Accum
Time] and totaled those numbers. The total number didn't come out the same.

Here is my SQL statement:

SELECT qryBilling_Summary.[Aff Group], qryBilling_Summary.[Client ID],
qryBilling_Summary.[Client Legal Name], Sum(qryBilling_Summary.[Total Accum
Time]) AS [SumOfTotal Accum Time], Sum(qryBilling_Summary.[Interim Amount
Billed]) AS [SumOfInterim Amount Billed], Sum([Interim Amount Billed]-[Total
Accum Time]) AS [Diff of Interim & Actual]
FROM qryBilling_Summary
GROUP BY qryBilling_Summary.[Aff Group], qryBilling_Summary.[Client ID],
qryBilling_Summary.[Client Legal Name]
HAVING (((qryBilling_Summary.[Aff Group]) Like nz([Please Enter Aff
Group],"*")) AND ((qryBilling_Summary.[Client ID]) Like nz([Please Enter
Client ID],"*")) AND ((Sum(qryBilling_Summary.[Interim Amount Billed]))=0));
 
AccessHelp said:
KARL DEWEY said:
Please post your SQL statement and tell us how you are totaling the number
without the SQL.

Hi Karl,

Thanks Karl. I took the numbers (both sum and non-sum) from [Total Accum
Time] and totaled those numbers. The total number didn't come out the same.

Here is my SQL statement:

<snip>


AccessHelp,

The query, realigned for readability (when this posts to the
newsgroup, there will be line-wraps, my apologies):


SELECT qryBilling_Summary.[Aff Group]
,qryBilling_Summary.[Client ID]
,qryBilling_Summary.[Client Legal Name]
,Sum(qryBilling_Summary.[Total Accum Time]) AS [SumOfTotal
Accum Time]
,Sum(qryBilling_Summary.[Interim Amount Billed]) AS
[SumOfInterim Amount Billed]
,Sum([Interim Amount Billed]-[Total Accum Time]) AS [Diff of
Interim & Actual]
FROM qryBilling_Summary
GROUP BY qryBilling_Summary.[Aff Group]
,qryBilling_Summary.[Client ID]
,qryBilling_Summary.[Client Legal Name]
HAVING (((qryBilling_Summary.[Aff Group]) Like nz([Please Enter
Aff Group],"*"))
AND ((qryBilling_Summary.[Client ID]) Like nz([Please Enter
Client ID],"*"))
AND ((Sum(qryBilling_Summary.[Interim Amount Billed]))=0));


What is your sample data?

What values are you entering at the prompts?

What are the results you are getting?

What do you mean by "non-sum"?


Sincerely,

Chris O.
 
Chris2,

Thanks for the message. If you would, please look up the tread that I
re-posted today with the tread name "Please Help!".

I really need help with that problem. Thanks.

Chris2 said:
AccessHelp said:
:

I am creating a SQL query for my report. The problem is when I sum the
transactions in SQL query, the total number comes out different from the
total number that I don't sum in SQL query.

Does anyone know why?

Thanks.

KARL DEWEY said:
Please post your SQL statement and tell us how you are totaling the number
without the SQL.

Hi Karl,

Thanks Karl. I took the numbers (both sum and non-sum) from [Total Accum
Time] and totaled those numbers. The total number didn't come out the same.

Here is my SQL statement:

<snip>


AccessHelp,

The query, realigned for readability (when this posts to the
newsgroup, there will be line-wraps, my apologies):


SELECT qryBilling_Summary.[Aff Group]
,qryBilling_Summary.[Client ID]
,qryBilling_Summary.[Client Legal Name]
,Sum(qryBilling_Summary.[Total Accum Time]) AS [SumOfTotal
Accum Time]
,Sum(qryBilling_Summary.[Interim Amount Billed]) AS
[SumOfInterim Amount Billed]
,Sum([Interim Amount Billed]-[Total Accum Time]) AS [Diff of
Interim & Actual]
FROM qryBilling_Summary
GROUP BY qryBilling_Summary.[Aff Group]
,qryBilling_Summary.[Client ID]
,qryBilling_Summary.[Client Legal Name]
HAVING (((qryBilling_Summary.[Aff Group]) Like nz([Please Enter
Aff Group],"*"))
AND ((qryBilling_Summary.[Client ID]) Like nz([Please Enter
Client ID],"*"))
AND ((Sum(qryBilling_Summary.[Interim Amount Billed]))=0));


What is your sample data?

What values are you entering at the prompts?

What are the results you are getting?

What do you mean by "non-sum"?


Sincerely,

Chris O.
 
Back
Top