const deptCodes = ['001', '002', '003']
const getMembersQuery = {
text: 'SELECT member_id FROM member_tbl WHERE dept_code IN ($1) AND delete_flg = 0',
values: [deptCodes],
rowMode: 'array'
};
const getMembersQuery Result = await client.query(getMembersQuery );
I am writing the above query but I am getting an error, malformed array literal: "001,002,003"\
001,002,003should be'001','002','003'i.e. inside the SQL itself it needs those singles quotes$1can be interpreted as 3 separate stings each having a start and end single quote with commas between values. For this look at how you escape single quotes e.g. stackoverflow.com/questions/15087497/…