© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•4mo ago•
4 replies
Valerka

Update many rows

Is it possible to update many rows in the table using db.update(table).set(...).from() ?

Specifically I want to achive this sql query:
UPDATE users u
SET
  score   = v.new_score,
  status  = v.new_status,
  rank    = v.new_rank
FROM (
  VALUES
    (1, 100, 'active',  5),
    (3,  85, 'inactive', 7),
    (5, 120, 'pending', 3)
) AS v(id, new_score, new_status, new_rank)
WHERE u.id = v.id
RETURNING *
UPDATE users u
SET
  score   = v.new_score,
  status  = v.new_status,
  rank    = v.new_rank
FROM (
  VALUES
    (1, 100, 'active',  5),
    (3,  85, 'inactive', 7),
    (5, 120, 'pending', 3)
) AS v(id, new_score, new_status, new_rank)
WHERE u.id = v.id
RETURNING *


But cannot get
.from
.from
working.
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

On inserting many, many rows
Drizzle TeamDTDrizzle Team / help
2y ago
update multiple rows
Drizzle TeamDTDrizzle Team / help
3y ago
Batch Update multiple rows.
Drizzle TeamDTDrizzle Team / help
2y ago
update many to many relationship
Drizzle TeamDTDrizzle Team / help
11mo ago