How to use IN clause in Slick? How to use IN clause in Slick? sql sql

How to use IN clause in Slick?

You can do this with the method .inSet (see here):


Slick queries are composable. Subqueries can be simply composed, where the types work out, just like any other Scala code.

val address_ids = addresses.filter( === "New York City").map( in address_ids).result // <- run as one query

The method .in expects a sub query. For an in-memory Scala collection, the method .inSet can be used instead.

So that would mean for your code:

val nameFilter= List("Sachin","Naveen")val filteredQuery = query.filter( result=

Depending on the source of that input you should consider using .inSetBind to escape the input (see this SO post).