Hi Ben, > I was wondering whether there is an example of how to do a nested select in > an update statement: > > UPDATE table SET column = (SELECT something FROM somewhere)
I'm afraid there isn't an example in the manual. I'll fix this soon: https://sourceforge.net/apps/trac/jooq/ticket/1558 > This appears to be the subject of this ticket > (http://sourceforge.net/apps/trac/jooq/ticket/60), which is marked as being > fixed, so I assume that you must be able to build the above construct using > the DSL. Right. Note that org.jooq.Select implements org.jooq.FieldLike, which exposes an asField() method: http://www.jooq.org/javadoc/latest/org/jooq/FieldLike.html Essentially, you can achieve this as such: create.update(TABLE) .set(COLUMN, create.select(something).from(somewhere).asField()) Hope this helps. Probably it would make sense to add .set(Field<?>, Select<?>) methods to various DSL API types, for convenience. I'll track this as #1559: https://sourceforge.net/apps/trac/jooq/ticket/1559 Cheers
