0
如何實現Slick中的等價物?哪裏條件在Slick
select * from table1 where col1 = 1 AND (col2 = 2 or col3 = 3)
這不起作用:
val action = table.filter(_.col1 === 1 && (_.col2 === 2 || _.col3 === 3)).result
如何實現Slick中的等價物?哪裏條件在Slick
select * from table1 where col1 = 1 AND (col2 = 2 or col3 = 3)
這不起作用:
val action = table.filter(_.col1 === 1 && (_.col2 === 2 || _.col3 === 3)).result
您不能使用短針在這種情況下。試試這個:
val action = table.filter(x => x.col1 == 1 && (x.col2 == 2 || x.col3 == 3)).result
順便說一下,這個方法適用於'==='而不是'==' – ps0604