I need to be able to update multiple columns on a table using the result of a subquery. A simple example will look like below -
UPDATE table1
SET (col1, col2) =
UPDATE table1
SET
col1 = subquery.min_value,
col2 = subquery.max_value
FROM
(
SELECT
1001 AS col4,
MIN (ship_charge) AS min_value,
MAX (ship_charge) AS max_value
FROM orders
) AS subquery
WHERE table1.col4 = subquery.col4
You can also return multiple rows in the subquery if you want to update multiple rows at once in table1.