如何构建以下PSQL查询以使用jOOQ 3.10.x更新多个记录?
UPDATE users
SET name = s.name, city = s.city
FROM users_staging s
WHERE users.id = s.id;
答案 0 :(得分:1)
UsersStaging s = USERS_STAGING.as("s");
DSL.using(configuration)
.update(USERS)
.set(USERS.NAME, s.NAME)
.set(USERS.CITY, s.CITY)
.from(s)
.where(USERS.ID.eq(s.ID))
.execute();