I appreciate that this questions has been covered many times but cannot seem to get it to work for my scenario, I'm just not getting the syntax nor implementation right.
Right now I have a very simple update method that updates 1 column, finding that user by it's id
User.update = (id, value) => {
pool.query('UPDATE users SET membership_expiry_date = $2 where id = $1', [id, value], (err) => {
if (err) {
return console.error(err);
}
return console.log('User Updated');
});
};
await User.update(req.body.user_id, "value");
I have multiple columns that I would like to update and not sure how to set this up. Each time I update i could have a different number of columns to update, depending on what information is being updated