Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

whereIn knex

const myArray = [1,2,3]
knex.raw('select * from users where id in (' + myArray.map(_ => '?').join(',') + ')', [...myArray]);
// query will become: select * from users where id in (?, ?, ?) with bindings [1,2,3]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #whereIn #knex
ADD COMMENT
Topic
Name
4+5 =