Hi,
I have a 5 row table with the following values.
key value
1 5
2 10
3 15
4 15
5 5
I wish to select the values, and their relative percentages, ie, the
result should be:
value percentage
5 10
10 20
15 30
15 30
5 10
I am able to do it with the following SQL query, but is there a better
way to do it (maybe by using only one select statement)?
select
value,
100*(value/total.total) as percentage
from
test,
(
select
sum(value) as total
from
test
) total
Thanks,
Avinash