Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 percentage

Author  Topic 

sateesh.sqldba
Starting Member

25 Posts

Posted - 2010-06-23 : 12:38:14
i have three columns a,b,c i wan to take percentage of all three
like a/(a+b+c) * 100,b/(a+b+c)* 100 like this but i am getting 0 value


sateesh

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-06-23 : 12:42:24
wat about this>

a/(a+b+c) * 100.0,b/(a+b+c)* 100.0

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sateesh.sqldba
Starting Member

25 Posts

Posted - 2010-06-23 : 12:47:11
[quote]Originally posted by visakh16

wat about this>

a/(a+b+c) * 100.0,b/(a+b+c)* 100.0

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

getting 0.0 value

sateesh
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-06-23 : 12:49:01

can you check what are values of a,b & c?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

sateesh.sqldba
Starting Member

25 Posts

Posted - 2010-06-23 : 12:52:57
quote:
Originally posted by visakh16


can you check what are values of a,b & c?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/






i have a is count value
like a=23
b=13
c=14
i need a/(a+b+c) * 100 this gives percentage

sateesh
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-06-24 : 02:40:00
100.0*a/(a+b+c) ,100.0*b/(a+b+c)

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -