I have a table that contains two columns, both have email values.
I want to create a query that update a specific data in both columns.
My question is how the query should look like.
The simplest way is to run two update statements:
update table set col1 = <newval> where col1 = <oldval>; update table set col2 = <newval> where col2 = <oldval>;
This begs of the question of why two columns are storing the same data. Perhaps you need to review your data structure and use a junction table for this information.
If you insist of one statement:
update table set col1 = iif(col1 = 'aa', 'bb', col1), col2 = iif(col2 = 'aa', 'bb', col2) where col1 = 'aa' or col2 = 'aa'