SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Posting Yak Master

142 Posts

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


United Kingdom
12543 Posts

Posted - 09/26/2006 :  11:57:37  Show Profile  Visit nr's Homepage  Reply with Quote
No idea what that means.

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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000