mirror of
https://github.com/groue/GRDB.swift
synced 2026-11-22 04:00:39 +00:00
After failed experiment: SELECT ... FROM parent JOIN (SELECT * FROM child LIMIT 1) child ON child.parentId = child.id The problem is that the join condition can't go inside the subquery, because SQLite complains about unknown table "parent". And when the join condition is outside the subquery, the LIMIT clause has been applied too early. So we're still stuck with: SELECT ... FROM parent JOIN child ON child.id = (SELECT id FROM child WHERE child.parentId = child.id LIMIT 1) For some reason SQLite accepts the reference to the parent table in this case.