DT
Drizzle Team•13mo ago
Dev Emm

Increment without first selecting

UPDATE table_name SET column_name = column_name + 1 WHERE condition;
UPDATE table_name SET column_name = column_name + 1 WHERE condition;
please any easy way to do this with drizzle? talking about the SET column_name = column_name + 1 part
2 Replies
ericmartinezr
ericmartinezr•13mo ago
You can do
db.update(table)
.set({
columnName: sql`${tableName.columnName} + 1`
})
db.update(table)
.set({
columnName: sql`${tableName.columnName} + 1`
})
Dev Emm
Dev EmmOP•13mo ago
wow 🫡 , will try it out thanks!
Want results from more Discord servers?
Add your server