I'm using Jooq and am trying to generate a near copy of a data set within the same table. In the process I want to update the value of one field to a known value. I've been looking at the docs & trying variations with no luck yet. Here is my approach updating the REGISTRATION table and setting the 'stage' field to the value 6 (where it was 5). So I'll end up with the original data plus a duplicate set with just the different stage value. in pseudo code
insert into Registration (select * from Registration where stage=5) set stage=6
I tried this code below and thinking I could add a ".set(...)" method to set the value but that doesn't seem to be valid.
create.insertInto(REGISTRATION)
.select(
(selectFrom(REGISTRATION)
.where(REGISTRATION.STAGE.eq(5))
)
).execute();
SET
clause after anINSERT .. SELECT
? – Hadlock