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)
})


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

Is there any way to do this?
Was this page helpful?