Node.js sqlite3 IN operator

后端 未结 2 801
野的像风
野的像风 2021-02-14 07:25

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 08:02

    Slight variation on asbel's great answer:

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

提交回复
热议问题