Zyle Moore
04/11/2026, 7:18 AMCreature
.join(
RandomizedCreature,
JoinType.INNER,
onColumn = Creature.id,
otherColumn = RandomizedCreature.original_entry
)
.update {
it[Creature.id] = it[RandomizedCreature.randomized_entry]
}Zyle Moore
04/11/2026, 7:43 AMUPDATE
creature c
JOIN
randomized_creature rc
ON
c.id = rc.original_entry
SET
c.id = rc.randomized_entryZyle Moore
04/11/2026, 7:45 AMRandomizedCreature
.select(RandomizedCreature.original_entry, RandomizedCreature.randomized_entry)
.forEach { rc ->
val originalEntry = rc[RandomizedCreature.original_entry]
val randomizedEntry = rc[RandomizedCreature.randomized_entry]
Creature
.update({ Creature.id eq originalEntry }) { c ->
c[Creature.id] = randomizedEntry
}
}
This generated lots of updates, but since each one contained a different WHERE, it updated rows that had already been updated.Zyle Moore
04/11/2026, 7:53 AMChantal Loncle
04/14/2026, 1:06 AMJoin, using the same DSL as in your first example. It's just that you're using it on both sides of the assignment operator, when you can't (and don't have to).
The following works on MySQL to generate the required SQL syntax you mentioned:
Creature
.join(
RandomizedCreature,
JoinType.INNER,
onColumn = Creature.id,
otherColumn = RandomizedCreature.original_entry
)
.update {
it[Creature.id] = RandomizedCreature.randomized_entry
}