KyselyK
Kysely3y ago
mike

How to reference the parent query when creating a subquery itself?

What if I want to use kysely to create a subquery with a literal reference only and use it in sequelize ORM as literal?

// Here I want to generate the subquery with a reference to non-existing parent
const kyselySubquery =
select
    id
from
    pricing as latest
where
    latest.product_id = parent.product_id // parent does not exists in this context...!
order by
    latest.date desc
limit 1


// I plan to use it in my ORM as a subquery literal
select
*
from
pricing as parent
where
id in /*kyselySubquery */
Was this page helpful?