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!

SUM problem with multiplier

Status
Not open for further replies.

desperateUser

Technical User
Aug 4, 2005
47
CA
This is making me nuts.

SELECT SUM(r.entry_amt)+SUM(r.entry_amt*.035) AS AMOUNT

I can select SUM(r.entry_amt) and get the right result. I can select SUM(r.entry_amt*.035) and get the right result but I can't add them as in the statement above.

What gives?!?

Penelope
 
why not

Code:
select sum(r.entry_amt) * 1.35 as AMOUNT

Hope it helps,

Alex


[small]----signature below----[/small]
I can't compete with you physically, and you're no match for my brains.
You're that smart?
Let me put it this way. Have you ever heard of Plato, Aristotle, Socrates?
Yes.
Morons!
 
What error do you get? I see nothing wrong with

Code:
SELECT SUM(r.entry_amt)+SUM(r.entry_amt*.035) AS AMOUNT

[COLOR=black #e0e0e0]For SQL and technical ideas, visit my blog, Squared Thoughts.

[sub]The best part about anything that has cheese is the cheese.[/sub][/color]
 
All I get is the sum of r.entry_amt, the calculation doesn't happen. There is no error message.
 
Can you put the result of following query here:

SELECT SUM(r.entry_amt), SUM(r.entry_amt*.035), SUM(r.entry_amt)+SUM(r.entry_amt*.035) AS AMOUNT

May be this helps in getting the cause of error.
 
Well, it seems to work but I need to remember what I was doing when it didn't! Thank you, can I reserve the right to revisit this if necessary?

:D
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top