LoginSignup
0
0

More than 1 year has passed since last update.

【Node.js】MySQLのIN句に配列の要素を指定する方法

Posted at

配列の要素をMySQLのクエリのIN句に指定したい時。

const selectUsers = [ '田中', '鈴木', '木下' ];

const sql = 'SELECT * FROM users WHERE name IN (?)';
const res = await mysql.query(sql, [selectUsers]);

参考:
https://qiita.com/komatsu_1324/items/df1253fb3d4b3e312d17

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0