Raphaël K
06/01/2022, 11:19 AMWITH ten_parents AS (SELECT * from parent LIMIT 10)
SELECT *
FROM ten_parents p
LEFT JOIN child c
ON c.parent_id = p.id
The goal here is to limit a join request but only for the parents, as they can have several children 🙂spand
06/01/2022, 11:39 AMSELECT *
FROM (SELECT * from parent LIMIT 10) AS p
LEFT JOIN child c
ON c.parent_id = p.id
Isnt that enough ?Raphaël K
06/01/2022, 11:41 AMspand
06/01/2022, 11:45 AMtbl.slice(col1).selectAll().limit(10).alias("p")
Raphaël K
06/01/2022, 11:53 AMval query = (PlaceTable leftJoin PlaceScheduleTable).selectAll()
.apply { if (count != null) limit(count, offset) }.alias("p")
val results = query
.leftJoin(PlaceImageTable, { PlaceImageTable.place }, { query[PlaceTable.id] })
.leftJoin(FileTable, { FileTable.id }, { PlaceImageTable.file })
.selectAll()
spand
06/01/2022, 12:52 PMquery
when you do it later alsoRaphaël K
06/01/2022, 12:54 PM