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
 Import/Export (DTS) and Replication (2000)
 Percent

Author  Topic 

sardinka
Posting Yak Master

142 Posts

Posted - 2004-12-06 : 17:10:14
I have a query where I have a results as this:
Result
1
1
2
2
Is is some how I can get the second column with applicable % (assuming the total=100%)

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2004-12-06 : 17:47:22
Try this:
select Result, 1.0 * Result / tot.sumtot as [Percent]
from tbl join ( select sum(Result) as sumtot from tbl ) tot on 1 = 1

rockmoose
Go to Top of Page
   

- Advertisement -