Node.js sqlite3 IN operator

后端 未结 2 742
抹茶落季
抹茶落季 2021-02-14 07:27

So I am currently trying to make a query in Node.js:

// friends is an array object
db.all(\'SELECT email \' +
       \'FROM users\' +
       \'WHERE email in ?\'         


        
2条回答
  •  借酒劲吻你
    2021-02-14 07:59

    Slight variation on asbel's great answer:

    db.all(
        `SELECT email FROM users WHERE email in (${ friends.fill('?') })`, 
        friends, 
        callback
    );
    

提交回复
热议问题