© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•2y ago•
2 replies
bageren

Using column of relation in where clause

I would like to do something like this:

database.query.tableOne.findMany({
   with: {
       tableTwo: {
            columnOne: true
       }
   }
  where: eq(tableTwo.columnOne, 10)
})
database.query.tableOne.findMany({
   with: {
       tableTwo: {
            columnOne: true
       }
   }
  where: eq(tableTwo.columnOne, 10)
})


The above query causes the following error:
missing FROM-clause entry for table "tableTwo"
missing FROM-clause entry for table "tableTwo"


Is there any way to do this?
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

Using relation columns in where clause (Drizzle playground provided)
Drizzle TeamDTDrizzle Team / help
16mo ago
Nested Where Clause in Many-to-Many relation using Query
Drizzle TeamDTDrizzle Team / help
2y ago
Trouble using findMany with joined relation and where clause on relation
Drizzle TeamDTDrizzle Team / help
2y ago
Where clause dependent on with relation
Drizzle TeamDTDrizzle Team / help
2y ago