Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Decimal in Wrong Place

Status
Not open for further replies.

mwake

Programmer
Feb 12, 2004
151
US
I am trying to summarize multiple bill amounts and I am getting the right numbers but the decimal is in the wrong spot. When I use this statement to get bill amounts for a case, it returns the correct amounts:
BILL_TOTAL= sum(CASE [TRAN_TYPE] WHEN 'BL' THEN([FEES_AMT]+[HARD_AMT]+[SOFT_AMT])*[SIGN] WHEN 'BLX' THEN([FEES_AMT]+[HARD_AMT]+[SOFT_AMT])*[SIGN] ELSE 0 end)
Results: 3475.18000000 and 29740.70000000
However, when I sum those 2 amounts by client, I get 332158.80000000 instead of 33215.88000000. All the fields being added in my statement are EXPCURRENCY(decimal(25,10)),null)
How do I fix this??
 
Hard to tell with that field in isolation, but most likely, there's something in your code that's causing you to add these values in multiple times.

Tamar
 
I am trying to summarize multiple bill amounts and I am getting the right numbers but...

Could it be that you are summarizing 10 rows, resulting in your result being 10 times as great as what you expect?

First return the DISTINCT values and then SUM().

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top