1

I am using slonik lib to run that query connection of DatabaseTransactionConnectionType

const fileIds = ["3001"];
const noteId = 424;

 const query = sql`
  UPDATE file SET note_id = ${noteId}
  WHERE file_id in (${fileIds})`;
 await connection.maybeOne(query);

but I got that exception

TypeError: Unexpected value expression

any idea whats wrong in my query

Mina Fawzy
  • 20,852
  • 17
  • 133
  • 156

1 Answers1

1

Try

const query = sql`
  UPDATE file SET note_id = ${noteId} WHERE id IN (${sql.valueList(fileIds)})`;