© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
4 replies
soar

Dynamic where query

With a relational query, is there a way to change the
where
where
query based on user input?

In Knex.js, we could do something like this:

knex('questions')
    .select('question', 'correct', 'incorrect')
    .modify(function(queryBuilder) {
        if (req.query.param) {
            queryBuilder.where('somecolumn', req.query.param);
        }
    });
knex('questions')
    .select('question', 'correct', 'incorrect')
    .modify(function(queryBuilder) {
        if (req.query.param) {
            queryBuilder.where('somecolumn', req.query.param);
        }
    });
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
Dynamic query building
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
Dynamic select() query builder
Drizzle TeamDTDrizzle Team / help
12mo ago