MERGE
別のテーブルから選択した値に基づいて値を設定したい。このようなもの:
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
id が 0 より大きい各行でこれが発生するようにします。さらに、table1 の column1 の値を、前の行の column1 の値に table2 の column2 の値を加えたものにします。
H2 データベースを使用しています。