this is my table
ID angka1 angka2
1 80 20
2 10 20
3 10 20
4 0
I want to sum angka1 vertically, so the value of angka1 on ID 4 is 100, i already try with code below and works, but i want a simple one, because i have another table (this one is just prototype) with many ID, and this code would very long to write.
update halooo set angka1 = (
select sum(db1+db2+db3) from(
select
(select sum(angka1) from halooo where id=1)db1,
(select sum(angka1) from halooo where id=2)db2,
(select sum(angka1) from halooo where id=3)db3
)total
)
where id = 4
i try with this one but this code not update my table,
update halooo
set
angka1=(
select sum(angka1) from(
select sum(angka1) from halo) a
)
where id=4
can someone point where is my mistake?