I know we can use IN clause through querybuilder as:
await manager.getRepository(ReportEntity).createQueryBuilder()
.select('id')
.where('job_id IN (:...ids)',{ids:query_data[i].array_agg})
.getRawAndEntities()
Is it possible to do the same in a raw sql query? If yes, how do I pass parameters to IN clause in a raw query?
If I want to do it like this:
await manager.query("select id from report where job_id IN (:...ids)",[{ids:['d8add1db-41fe-4e2d-b287-037fc22f1d29','a07497b7-1a94-482a-988c-1e2dcf6059c6']}])
await manager.query(
'SELECT id from report where job_id = ANY($1)',
[['d8add1db-41fe-4e2d-b287-037fc22f1d29', 'a07497b7-1a94-482a-988c-1e2dcf6059c6']]
)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With