© 2026 Hedgehog Software, LLC

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

Using `$dynamic()` to enhance where clause

I have a function like:

export const applyFilter = (qb: SQLiteSelect, paging: Paging, filter: string | undefined) => { .. }
export const applyFilter = (qb: SQLiteSelect, paging: Paging, filter: string | undefined) => { .. }


which adds
limit
limit
and
offset
offset
and also
where
where
using
qb.where(..)
qb.where(..)
.

This works great, but now I have the use case the
qb
qb
received already contains a where clause.
But the
qb.where(..)
qb.where(..)
overwrites it unfortunately.

Is there a way to merge them instead, if the
qb
qb
already has a where?
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

Dynamic where clause
Drizzle TeamDTDrizzle Team / help
3y ago
Double 'where' clause in dynamic query overriding the original 'where' clause not combining
Drizzle TeamDTDrizzle Team / help
15mo ago
Using column of relation in where clause
Drizzle TeamDTDrizzle Team / help
2y ago
Missing nested where clause
Drizzle TeamDTDrizzle Team / help
2y ago