H2 update with join

后端 未结 1 1333
滥情空心
滥情空心 2021-01-11 14:28

As development DB I am using MySQL, and for tests I am using H2 database. The following script works in MySQL very well, but it is fails on H2.

UPDATE `table         


        
1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-11 15:29

    Try something like this:

    update table_a a
    set a.b_id = (select b.id from table_b b where b.a_id = a.id)
    where exists
    (select * from table_b b where b.a_id = a.id)
    

    0 讨论(0)
提交回复
热议问题