November 3, 2009 at 12:09 pm
I am trying to get percentages. I realize that I am doing integer division and the result will be an integer. I have tried to cast the numerator and the denominator and the entire result. I either get 0.000000 or 1.000000
Calculation1: sum(a) / (sum a + b) as Percentage (statement without cast/convert).
Calculation1: sum(b) / (sum a + b) as Percentage (statement without cast/convert).
I am doing this twice and the percentages will be 99.999365% and 0.000635%.
Any ideas?
Thanks.
November 3, 2009 at 12:19 pm
Try making it "sum(a*1.0)" in the numerator. See what that gives you.
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
November 3, 2009 at 12:21 pm
I figured it out; it was a group by with the combination of Case..sum instead of sum(Case).
Thanks.
September 21, 2010 at 9:05 am
can you post the entire code.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply