We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example:
FooTable.innerJoin(BarTable).update({ FooTable.foo eq BarTable.bar }) { it[BarTable.baz] = 123 }
Exception:
org.h2.jdbc.JdbcSQLSyntaxErrorException: Syntax error in SQL statement "UPDATE FOOTABLE INNER[*] JOIN BARTABLE ON FOOTABLE.ID = BARTABLE.FOO_ID SET BAZ =? WHERE FOOTABLE .FOO = BARTABLE.BAR"; expected "., AS, SET";
The text was updated successfully, but these errors were encountered:
It seems like H2 doesn't support update with join, but exists can be used instead.
exists
BarTable.update({ exists(FooTable.slice(FooTable.id).select { (BarTable.fooId eq FooTable.foo) and (BarTable.bar eq FooTable.foo) } )}) { it[baz] = 123 }
UPDATE BARTABLE SET BAZ=? WHERE EXISTS ( SELECT FOOTABLE.ID FROM FOOTABLE WHERE BARTABLE.FOO_ID = FOOTABLE.FOO AND BARTABLE.BAR = FOOTABLE.FOO )
For cases when a column needs to be updated with value from the joined table, there is MERGE INTO ... WHEN MATCHED THEN UPDATE ... statement.
MERGE INTO ... WHEN MATCHED THEN UPDATE ...
Sorry, something went wrong.
[h2] Failed on update with inner join #636
3d74a06
[h2] Failed on update with inner join #636 / Limit unsupported on H2 …
9669d2c
…update join
66b0f95
efc2132
Tapac
No branches or pull requests
Example:
Exception:
The text was updated successfully, but these errors were encountered: