L
L
lavezzi12019-06-28 07:45:34
MySQL
lavezzi1, 2019-06-28 07:45:34

Mysql2 returns one value instead of multiple, why?

I am using mysql2 package for nodejs. I'm trying to make a query like this:

const requested = [47, 48, 49];

const images = await connection.query(
  'SELECT * FROM images WHERE id = ?',
  requested,
);

There are definitely records with these id's. In response, I get an array with one entry, the first (47). What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2019-06-28
@lavezzi1

it is worth to esteem about syntax IN?
compare www.mysqltutorial.org/sql-in.aspx with your query.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question