Solved

Calculate percentage (2)

Posted on 2009-06-29
2
213 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PERFORMANCE OF SQL QUERY 13 85
sql query help 2 68
Find data in a column which is not in  a date format 29 39
Downgrading MS SQL 2008 R2 Enterprise to MS SQL 2005 Standard? 12 95
If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

734 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