declare @t table( id int identity(1,1), LevelId int, Percentage int)
insert @t(LevelId, Percentage)
SELECT 1, 100 union all
SELECT 2, 0 union all
SELECT 3, 0 union all
SELECT 4, 0 union all
SELECT 1, 50 union all
SELECT 2, 50 union all
SELECT 3, 0 union all
SELECT 1, 20 union all
SELECT 2, 30 union all
SELECT 3, 40 union all
SELECT 4, 0 union all
SELECT 1, 50 union all
SELECT 2, 10
/*Expected OUTPUT
ID LevelId Percentage SumOf%
1 1 100 100
2 2 0 100
3 3 0 100
4 4 0 100
5 1 50 100
6 2 50 100
7 3 0 100
8 1 20 90
9 2 30 90
10 3 40 90
11 4 0 90
12 1 50 60
13 2 10 60*/
Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif