L
L
lavezzi12019-07-20 12:05:05
MySQL
lavezzi1, 2019-07-20 12:05:05

MySQL in nodejs, syntax error, why?

mysql2 package.

await connection.query(
  'UPDATE files SET deletedAt = (?) WHERE key IN (?)', 
  [now, [keys]]
);

Error: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'key IN (('image/1562423492611.png'))' at line 1

What's wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Melkij, 2019-07-20
@lavezzi1

https://mariadb.com/kb/en/library/reserved-words/
You can use keywords as identifiers, but you must do it correctly. Better yet, don't use keywords for identifiers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question