Hi Guys,
This is my first thread here. I am trying to update a column with the sum of the column(Col1) but it should be grouped by on another column (Col2)
Code:
update Table set Col1 = (select sum(Col1)
from Table
where Col3=1
group by Col1,Col2)
where Col1=1
This is the sample data am trying with
Code:
COl1 Col2 Col3
0.4 2 1
0.8 2 1
5 3 1
The output should be
Code:
1.2 2 1
1.2 2 1
5 3 1
Thanks For your help in advance.
Regards,
Magesh