LoginSignup
1
0

More than 5 years have passed since last update.

Slickでcoalesceする方法

Posted at

scalaのPlayFrameworkでSlickを使用してDB操作を行う際のcoalesceのやり方メモ。

play-slickのバージョン

build.sbt
libraryDependencies += "com.typesafe.play" %% "play-slick" % "3.0.3"

記法

A.ifNull(B)

例えば

SELECT COALESCE(A,B) FROM TABLE_NAME

val query = TableQuery[TABLE_NAME].map(x => x.A.ifNull(x.B))

となる

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0