Dynamic where query
With a relational query, is there a way to change the
In Knex.js, we could do something like this:
where query based on user input?In Knex.js, we could do something like this:
whereknex('questions')
.select('question', 'correct', 'incorrect')
.modify(function(queryBuilder) {
if (req.query.param) {
queryBuilder.where('somecolumn', req.query.param);
}
});