thoredge
thoredge

Reputation: 12601

Update column by other column values in Scala Slick

Is there anyway to update column based on other column value in Slick2. In sql I would do it like this:

UPDATE table SET columna = columnb WHERE appropriate = true 

Upvotes: 0

Views: 619

Answers (1)

Richard Dallaway
Richard Dallaway

Reputation: 4320

Yes, but not using the "lifted embedded" (Scala collections style) of Slick.

You can:

  • Use plain SQL (the sqlu interpolator) to write your SQL to get that effect.
  • Use client-side update, where you read the rows, and update each row, and send it back to the database (possibly inside a transaction). Which is probably not what you want to do, but is an option.

For the lifted-embedded style, Slick issue 497 is worth tracking, as that's probably closest to the change you need.

Upvotes: 1

Related Questions