Hakon Grotte
11/08/2023, 9:19 AMExists
class returned from the exists()
function. Example use case: I have Person table and PersonReview table with fk to Person table. I want to select all people and include a bit/bool value if the individual persons have a review or not.Chantal Loncle
12/20/2023, 8:25 PM// query based on the SO suggested workaround
val existsOp = exists(Person.select { Person.name like "A%" })
val caseCondition = Case()
.When(existsOp, intLiteral(1))
.Else(intLiteral(0))
Person.slice(caseCondition).selectAll().toList()
// generates SQL
// SELECT CASE WHEN EXISTS (SELECT * FROM Person WHERE Person."name" LIKE 'A%') THEN 1 ELSE 0 END FROM Person
Hakon Grotte
12/21/2023, 7:55 AM