> One thing I forgot to ask was what it would look like when you want to > update more than 1 column with the same select statement, e.g. > > UPDATE Table SET col1, col2 > SELECT something, something_else FROM somewhere
That will depend on the database that you're using. In standard SQL UPDATE statements, this isn't possible (without writing several SELECT statements) If you're using any of those databases that support the standard SQL MERGE statement, then you could use a SQL statement as such MERGE INTO Table dst USING ( SELECT something, something_else FROM somewhere ) src ON (1 = 1) -- replace this by a more sensible join condition WHEN MATCHED THEN UPDATE SET dst.col1 = src.something, dst.col2 = src.something_else MERGE statements are supported by jOOQ. Writing them may turn out to be a bit clumsy because of the aliasing that is ususally required... H2's MERGE statement is now also supported, as of jOOQ 2.4.0 If you're using MySQL, I guess you could trick the INSERT INTO ... SELECT ... ON DUPLICATE KEY UPDATE statement into doing what you want: http://dev.mysql.com/doc/refman/5.6/en/insert.html Postgres natively supports UPDATE ... FROM, but this is not (yet) supported by jOOQ: http://www.postgresql.org/docs/9.2/static/sql-update.html
