Filtering findMany using related records

I have a restaurants table that has a one-to-one relation with an addresses table. I want to pull all of the restaurants and their address within specific lat/long bounds, but I'm struggling to figure out how to do that. A simplified version of what I want/have so far

await this.drizzleService.db.query.restaurants.findMany({
  where: (table) => and(between(/* what could I use here to specify table.address.latitude */, minLat, maxLat)),
  with: {
    address: true
  }
});


I'm trying to figure out if this is somethin Drizzle can do or if I need to break into using sql`` to do it
Was this page helpful?