Anthony Chung February 2016
Update Postgres rows using an array from client using Node.JS
I am receiving an array of values from the client(CLIENT) in Node and would like to update all rows whose R_ID column matches my array.
Other than iterating over the array and updating each looked up element in turn, is there any way for me to do the following?
- SELECT all records whose R_ID column matches a value from CLIENT
- UPDATE all records in column BOOL from FALSE to TRUE
jcaron February 2016
ANY and pass the array:
client.query("UPDATE some_table SET some_column=true WHERE id = ANY($1)",[array], function (err, result) ...
Asked in February 2016
Viewed 1,843 times
Answered 1 times
Leave an answer
Quote of the day: live life