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 2000 Forums
 SQL Server Development (2000)
 Percent

Author  Topic 

sardinka
Posting Yak Master

142 Posts

Posted - 2006-09-26 : 11:50:17
I have a table with 2 columns:
name and count
How do I found percent for each row in my all rows is 100%

nr
SQLTeam MVY

12543 Posts

Posted - 2006-09-26 : 11:57:37
No idea what that means.

maybe
select t.name, t.count, 100.0 * t.count/x.val
from tbl t
cross join (select val = sum(count) from tbl) x

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -