Here is a simplified table structre for what I am trying to do:
T1:
id,uid,group,value1
1,1,A,3
2,1,B,4
3,2,A,6
4,2,B,7
now I want that any uid that has both a row for group A and group B the value assosicated with group B will be added to the value in the row associated with Group B.
so the result for the above would be
1,1,A,7 (3+4)
2,1,B,4
3,2,A,13 (6+7)
4,2,B,7
there might also be uids for which only group A exists or only groups B exists in which case no changes t those lines should take place.
What I did so far is that I created a query that has one row for any row that needs to be updated:
id,uid,newval
1,1,7
3,2,13
The subquery is somewhat complex and joins the table that needs to be updated with it self.
now how do I use this to update the original table? (or how do I do it some other way)?
thanks.