scala – 使用Slick“选择”
发布时间:2020-12-16 18:15:57 所属栏目:安全 来源:网络整理
导读:有没有办法在Slick中执行这样的查询: "select * from foo where id IN (select other_id from bar where status = 'damaged')" 谢谢 解决方法 for{ f - foo,b - bar if (b.status === 'damaged' f.id === b.other_id)} yield f 这会产生 select x2."id" fro
有没有办法在Slick中执行这样的查询:
"select * from foo where id IN (select other_id from bar where status = 'damaged')" 谢谢 解决方法for{ f <- foo,b <- bar if (b.status === 'damaged' && f.id === b.other_id) } yield f 这会产生 select x2."id" from "foo" x2,"bar" x3 where (x2."id" = x3."other_id") and (x3."status" = 'damaged') 这与返回的行数相当.如果由于某种原因需要那个确切的查询,您可能需要扩展光滑或使用静态查询. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |