© 2026 Hedgehog Software, LLC

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

What's the recommended way to do a basic filter by a boolean column's value?

I can't figure out how to use a non-filter expression for filtering.

e.g., I would expect
db.select().from(appointment).where(appointment.canceled)
db.select().from(appointment).where(appointment.canceled)
to generate the equivalent sql
select * from appointment where appointment.canceled
select * from appointment where appointment.canceled
, which works exactly how I expect.
.where(() => appointment.canceled)
.where(() => appointment.canceled)
or
.where((a) => a.canceled)
.where((a) => a.canceled)
don't work either.

I can use
.where(sql`${appointment.canceled}`)
.where(sql`${appointment.canceled}`)

but surely there must be a simpler way?

I can provide this column as an argument to a filter, so why can't I use this column itself as a filter?
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

What's is the recommended way to do DB migrations, when deploying to vercel?
Drizzle TeamDTDrizzle Team / help
11mo ago
What's the recommended way to handle joins that aggregate results?
Drizzle TeamDTDrizzle Team / help
15mo ago
How to filter by a column in a related table?
Drizzle TeamDTDrizzle Team / help
3y ago
What is the recommended way to have a staging and a production environment?
Drizzle TeamDTDrizzle Team / help
13mo ago