Solved

Calculate percentage (2)

Posted on 2009-06-29
2
209 Views
Last Modified: 2012-05-07
See earlier post.

When I test the code I get following result:
50,100,75,25
but I should get: 20,40,30,10
How can I fix this?
0
Comment
Question by:johnkainn
2 Comments
 
LVL 37

Accepted Solution

by:
momi_sabag earned 500 total points
ID: 24734746
sorry
i had a mistake
try this

select distinct id, 100*sum(units) over(partition by id) / sum(units) over() as Unitspercentage
from myTable
0
 
LVL 14

Expert Comment

by:Jagdish Devaku
ID: 24734822
can u give the link of your previous post...???
0

Featured Post

Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

There are some very powerful Data Management Views (DMV's) introduced with SQL 2005. The two in particular that we are going to discuss are sys.dm_db_index_usage_stats and sys.dm_db_index_operational_stats.   Recently, I was involved in a discu…
When writing XML code a very difficult part is when we like to remove all the elements or attributes from the XML that have no data. I would like to share a set of recursive MSSQL stored procedures that I have made to remove those elements from …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question