How to use nested joins with relational query builder

I have a query like this:
const templates = await db.query.productSetTemplates.findMany({
limit: 12,
offset: /* not important */,
orderBy: /* not important */,
where: /* not important */,
with: {
productSet: {
with: {
products: {
limit: 1
}
}
},
prototypeProductSets: {
with: {
products: {
columns: {
id: true
}
}
}
}
}
})
const templates = await db.query.productSetTemplates.findMany({
limit: 12,
offset: /* not important */,
orderBy: /* not important */,
where: /* not important */,
with: {
productSet: {
with: {
products: {
limit: 1
}
}
},
prototypeProductSets: {
with: {
products: {
columns: {
id: true
}
}
}
}
}
})
I want to transform it to use relational query builder. I'm having problem with nested joins. How do I do this. I want to use rqb because, I have to make another query somewhere else and i think I shouldn't need to make that extra query if I use rqb.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server