ps0604
ps0604

Reputation: 1081

Where condition in Slick

How to achieve the equivalent in Slick?

select * from table1 where col1 = 1 AND (col2 = 2 or col3 = 3)

This doesn't work:

val action = table.filter(_.col1 === 1 && (_.col2 === 2 || _.col3 === 3)).result

Upvotes: 0

Views: 780

Answers (1)

ryan
ryan

Reputation: 1084

You cannot use the short hand in this case. Try this:

 val action = table.filter( x => x.col1 == 1 && (x.col2 == 2 || x.col3 == 3)).result

Upvotes: 2

Related Questions