Need SQL query for this requirment
22428Feb 28 2005 — edited Feb 28 2005Hi, can you please write a query for this simple logic. I am confusing myself..
input
SELECT * FROM TEST;
c1 c2 c3
--------------------------
1 1 5000
2 1 10000
3 2 20000
4 2 20000
5 3 30000
output
c1 c2
-------------
1 33%
2 66%
3 50%
4 50%
5 100%
i found some logic
first group by c2 then result of c3 is say 15000,40000,30000
then divide 5000/15000 =33%,10000/15000 =66%,20000/40000=50%,20000/40000=50%
30000/30000 = 100%.
pls write SQL Query for this requiremnt.
Thanks in Advance
Devender