I want to MERGE
values based on the value of a select from another table. Something like this:
MERGE INTO table1 (column1) key(id)
values (select amount from table2 where id = id limit 1 +
select column1 from table1 where id = id - 1 limit 1)
where id > 0
I want this to happen for each row where id is greater than 0. Additionally, I want the value of column1 in table1 to be the value of column1 in the previous row plus the value of column2 in table2.
I am using H2 database.