DT
Drizzle Team•10mo 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•10mo 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 Emm•10mo ago
wow 🫡 , will try it out thanks!
Want results from more Discord servers?
Add your server