1

I'd like to pass a several statements on a single line query. It's possible?

const sql = 'update table set column where id = ?;
             delete from table where id = ?
             delete from table where id = ?
             select * from table where id IN (select id from table where id = ?)'
await Database.rawQuery(`sql`, [id, id, id, id])

I tried this way but doesn't work. Somente could helpe me? Thanks

1 Answers1

0

I resolved this question with transaction. Like this.

await Database.transaction(async (trx) => {
      await trx.from('table').where('id', id).update({column: value})
      await trx.from('table').where('id', id).delete()
    
})