Multiple subquery on where condition in findMany
I wanted to know if how we could do a multiple subquery on the where condition on findMany.
where: (campaign, { eq, and, exists, or }) =>
and(
...whereCondition,
exists(
ctx.db
.select()
.from(influencerPerSlot)
.where(
and(
eq(campaign.id, influencerPerSlot.campaignId),
eq(influencerPerSlot.userId, userId),
),
),
),
notExists(
ctx.db
.select()
.from(bidWinner)
.where(eq(bidWinner.bidderSlotId, bidderSlot.id)),
),
),
I have this on my where condition but it shows an error ".primary: vttablet: rpc error: code = NotFound desc = Unknown column 'dbName_bidderSlot.id'" . Seems like it could not find the bidderSlot table. but if I replace the "campaign" on the where condition with "bidderSlot" the notExist condition worked but it will show an error "Unknown column dbName_campaign.id" which specify the exist condition.
0 Replies