kjelle
kjelle

Reputation: 73

How to do SQL "NOT LIKE" in Slick

I'm quite new to both Scala and Slick. A "LIKE" query was easy to make

query.filter(_.name like "%kjelle%")

but I'm not successful trying to do a "NOT LIKE" query. Couldn't find a notlike operator so my first thought was to try

query.filter(_.name !like "%kjelle%")

or

query.filter(!(_.name like "%kjelle%"))

but no success.

How can I do it in Slick?

Upvotes: 7

Views: 1545

Answers (1)

Regis Blanc
Regis Blanc

Reputation: 549

You can try to use filterNot:

query.filterNot(_.name like "%kjelle%")

Upvotes: 7

Related Questions