CASE/WHEN/THE/ in luced

Hello peopel?
how can i use this:
UPDATE skill SET name_skill = CASE idskill WHEN 30 THEN 'Linux' 40 THEN 'Windows' END WHERE idskill in(30, 40) and group_skill_idskill =28;

the closest I checked was:

.query()
    .whereIn('idskill', idSkill)
    .update(...listSkill)

remembering that these are fields with the name name_skill
I can not do this:
.update({name_skill: 'programmer', name_skill: 'DBA'})

field name_skill repeats and an object does not accept repeated key

thank’s

1 Like

Raw queries is the way to go here.

await Database.raw('SQL QUERY');

Also recommend checking the knex docs on raw queries.

1 Like

But in Lucid

go Database.raw
thank’s