Calculate percentage (2)

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?
johnkainnAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
momi_sabagConnect With a Mentor Commented:
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
 
Jagdish DevakuSr DB ArchitectCommented:
can u give the link of your previous post...???
0
All Courses

From novice to tech pro — start learning today.