I am pretty new in scala. Currently working on scala 2 and postgres is the DB. Now I have written a Left innerjoin query in slick like below
val executors = TableQuery[Executors]
val innerJoin = (for {
(rel,a) <- executors joinLeft executors on ( (e1, e2) => {
e1.column1 === e2.column1 && e1.column2 === e2.column2
} ) if rel.id === id
} yield rel.name)
When I tried to print innerJoin.result.statements.headOption it gives me desired query
But the problem I am facing is instead of yielding rel.name I want a.name. But I am getting error value name is not a member of slick.lifted.Rep[Option[Executors]].
I checked slick documentation , not sure what I am missing here .
I have fixed it by
a.map(_.name). Reference https://scala-slick.org/doc/3.0.0/queries.html