Can the update described below be completed in one UPDATE statement?
I want to update the Operators.name_id
values with the Users.name_id
values by joining on Users.name = Operators.op_name
. Both Users.name
and Operators.op_name
are have a unique
.
I know the situation described below doesn't follow "best practices", but it's a much simpler example of what I'm trying to do: namely updating a field with the value from another joined table.
Table: Users
user_id name
----------------
34 Billy
43 Jimmy
50 Joe
Table: Operators (before UPDATE)
op_id op_name user_id
-------------------------
12 Billy 35
35 Jimmy 46
33 Joe 99
Table: Operators (after UPDATE)
op_id op_name name_id
-------------------------
12 Billy 34
35 Jimmy 43
33 Joe 50