|
I am trying to get a percent from 2 fields ie add [A]+[B]/[A]*100 AS [C] to get my percent. if i try [A]/sum([A]+[B])*100 it returns a 0 and if i try sum([A]+[B])/[A]*100 i get a diide by zero error. values are [A] 3 [b] 1 percent should be 75. Thanks for any help on this
(comments are locked)
|
|
It's because this is doing integer division, so 3/sum(3+1) = 0 You need to convert the top line into a decimal, such as (3 * 1.0)/sum(3+1) = 0.75 This makes your query Thanks Kev that works perfect, I have really been struggling with percentages but I have a much better understanding now with your help. cheers
May 30 '12 at 09:03 AM
n3w2sql
(comments are locked)
|

