© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago
kayog123

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.
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Where clause on 'with' in findMany
Drizzle TeamDTDrizzle Team / help
17mo ago
Type-safe subquery in "extras" of findMany query
Drizzle TeamDTDrizzle Team / help
8mo ago
Missing where in findMany with
Drizzle TeamDTDrizzle Team / help
2y ago
Date condition on where function
Drizzle TeamDTDrizzle Team / help
3y ago