Skip to content

Instantly share code, notes, and snippets.

@mobiworx
mobiworx / query
Last active May 25, 2016 15:22
slick - query composition
// your "subquery"
val q1 = (for {
(a, b) <- someTable
.leftJoin(anotherTable).on(_.id === _.other_id)
} yield (a.id, b.id)).groupBy(_._1).map {
case (id, group) => (id, group.map(_._2.asColumnOf[String]))
}
val q2 = for {
((a, b), c) <- aaaTable