I have: Select some set of pairs. The first column is the id of row in table
, the second is the new value which should be assigned to that row.
-- the first query
CREATE TABLE tmp;
SELECT row_id, new_value
FROM [not essential tables and joins]; //PSEUDOCODE
-- another queries
FOR EACH tmp //PSEUDOCODE
UPDATE table SET value = new_value WHERE id = row_id;
-- QUESTION: CAN I MERGE SELECT AND UPDATE IN ONE QUERY?
-- I want avoid creating temporary table.
Problem: Iteration through table (as in example above) decrease clearness and speed of code.
Question: *How to do the same in single query