I using pg-promise with express 4 on node 8.2.0.
Inside that I want to concatenate where condition.
But, I couldn't find that way. Please help me.
I expect this.
let ids = [10, 20, 30]
db.query('SELECT * FROM table WHERE id = {something-way}', ids)
=> I expect to execute query like a SELECT * FROM table WHERE id = 10 & id = 20 & id = 30;
Question
Can I make query like it with pg-promise's methods? Or I must concatenate string?
Please lend me your wisdom.
It depends on the logic of your
WHEREclause.If the logic is to select all records where
idis one of the values, then you can use:csvmodifier supported by pg-promise, in combination with theWHERE INclause:And if it is something else, then again, it depends on the logic, which you would need to clarify in your question.