I want to update multiple records using a single update query in MS Access. I followed the idea mentioned in this answer (https://stackoverflow.com/a/65027/2935885) about inserting multiple records using a single query.
when I try this query it works:
UPDATE my_table left join (select 'rowid' as col_1, 'updated_value' as col_2 from onerow) new_values ON my_table.col_1 = new_values.col_1 set my_table.col_2 = new_values.col_2
(onerow is a dummy empty table)
However, when I extend it to multiple new values rows, MS Access gives an error "Operation must use an updateable query".
UPDATE my_table left join (
select 'rowid1' as col_1, 'updated_value1' as col_2 from onerow
union all
select 'rowid2' as col_1, 'updated_value2' as col_2 from onerow
union all
select 'rowid3' as col_1, 'updated_value3' as col_3 from onerow
) new_values ON my_table.col_1 = new_values.col_1 set my_table.col_2 = new_values.col_2
How to fix this? Or what's wrong in the query I made?