MS SQL Server also supports "update... from", but it has essentially been superceeded in SQL Server 2008 via the "merge" command. "merge" even conforms to SQL 2003.
http://sqlblog.com/blogs/hugo_kornelis/archive/2008/03/10/lets-deprecate-update-from.aspx http://en.wikipedia.org/wiki/Merge_%28SQL%29 Of course H2 already supports the "merge" command :-) Cheers Kerry On Wed, Dec 2, 2009 at 9:15 AM, Alexander Hartner < [email protected]> wrote: > Is this not an extension to ANSI SQL ? If it is I would prefer not to have > it to prevent creating database specific code. After all that is the purpose > of an SQL standard. > > > On 1 Dec 2009, at 20:11, Franklin Schmidt wrote: > > > Both Postgres and MySQL allow using a join in an update statements. > > For example, in Postgres I could do: > > > > update totals > > set total = total + increments.inc > > from increments > > where totals.id = increments.id > > > > The closest one can come with H2 is: > > > > update totals > > set total = total + (select inc from increments where totals.id = > > increments.id) > > where exists (select inc from increments where totals.id = > increments.id) > > > > which is ugly and I think will do each join twice. It would be nice > > if H2 had better syntax for this. > > > > -- > > > > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > [email protected]<h2-database%[email protected]> > . > > For more options, visit this group at > http://groups.google.com/group/h2-database?hl=en. > > > > > > -- > > You received this message because you are subscribed to the Google Groups > "H2 Database" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<h2-database%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/h2-database?hl=en. > > > -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
