RodolpheG
RodolpheG
DTDrizzle Team
Created by RodolpheG on 11/14/2023 in #help
Help with query, how to use parent value in where condition ?
Hey everyone, is there any way to pass a value from the parent, which is widgets in this example to a where condition in a left join ?
await db.query.widgets.findFirst({
where: eq(widgets.code, 'widget1'),
with: {
product: {
with: {
productFeedbacks: {
where: eq(schema.productFeedbacks.groupBrandCode, *WIDGETS.brandCode*),
}
}
},
}
});
await db.query.widgets.findFirst({
where: eq(widgets.code, 'widget1'),
with: {
product: {
with: {
productFeedbacks: {
where: eq(schema.productFeedbacks.groupBrandCode, *WIDGETS.brandCode*),
}
}
},
}
});
4 replies