How to plus 1 to the current value of a column when update

How to plus 1 to the current value of a column when updating a record
2 Replies
fi
fi2y ago
do i need to read the value first then only update it?
Andrii Sherman
You can use sql template
db.update(usersTable).set({
field: sql`${usersTable.field} + 1`
})
db.update(usersTable).set({
field: sql`${usersTable.field} + 1`
})
Want results from more Discord servers?
Add your server