I'm using the pg package for accessing my PostgreSQL database and would like to send a query like this:
const query = 'select * from myTable where myColumn in ($1)'
I tried multiple ways to use that query string but get errors for each of them
const listOfString = ['string1', 'string2']
db.query(query, listOfStrings)
or
db.query(query, listOfStrings.join(','))
adding a single quote to the texts does not work either
how can I execute this query?
'string1, string2'instead of['string1', 'string2']?select 1 from myTable where myColumn = any(array)? Checkout this doc: postgresql.org/docs/current/static/functions-comparisons.html