我是新手,有个问题一直困扰着我。我想查询一个名为attach的表,并找到数组b中包含的attach_id,该数组是一个普通的Scala数组:
val attaches: TableQuery[AttachTable] = TableQuery[AttachTable]
val b = Array[Int](1,2,3)
// This query works well, but I actually need the attach_id that in the array b
def query = for {
a <- attaches if (a.attach_id === 1)
} yield (a.url)
// If I replace it like this, it doesn't work, and I don't know why
def query = for {
a <- attaches if (b.contains(a.attach_id))
} yield (a.url)
// This also failed, because b is Array[Int]
def query = for {
a <- attaches if (a.attach_id in b)
} yield (a.url)有人能帮我吗?
发布于 2016-03-16 22:45:48
使用
def query = for{
a<-attaches if a.attach_id inSetBind(b)
} yield (a.url)https://stackoverflow.com/questions/35968260
复制相似问题