Hi! Could we please enable some services and cookies to improve your experience and our website?
create table tbl (
col1 int,
col2 int,
col3 int
);
insert into tbl (col1, col2) values (1, 12), (1, 32), (2, 10), (2, 5), (3, 6), (3, 10);
update tbl
join (
select col1, sum(col2) col2_sum from tbl group by col1
) summed on summed.col1 = tbl.col1
set col3 = col2_sum;
select * from tbl;