Derived tables for Postgres

Hi, I am trying to do a bulk update like this:
UPDATE your_table
SET someColumn = new_values.new_value
FROM (VALUES
(1, 'new_value_for_row_1'),
(2, 'new_value_for_row_2')
-- Add more rows as needed
) AS new_values (id, new_value)
WHERE your_table.id = new_values.id;
UPDATE your_table
SET someColumn = new_values.new_value
FROM (VALUES
(1, 'new_value_for_row_1'),
(2, 'new_value_for_row_2')
-- Add more rows as needed
) AS new_values (id, new_value)
WHERE your_table.id = new_values.id;
I found that UpdateQueryBuilder supports update joins with from method, but I couldn't find how to create derived tables like in the pure SQL shown above. Thanks!
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server