Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to do SQL "NOT LIKE" in Slick

Tags:

scala

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?

like image 541
kjelle Avatar asked Apr 25 '15 09:04

kjelle


1 Answers

You can try to use filterNot:

query.filterNot(_.name like "%kjelle%")
like image 60
Regis Blanc Avatar answered Oct 25 '22 12:10

Regis Blanc