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 AMRaphaƫl K
06/01/2022, 12:51 PMval 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()
Raphaƫl K
06/01/2022, 12:51 PMspand
06/01/2022, 12:52 PMspand
06/01/2022, 12:53 PMquery
when you do it later alsoRaphaƫl K
06/01/2022, 12:54 PM