I have two tables in Oracle 11:
Table ta_one:
name | active
----------------
john | yes
tina | yes
mike | yes
Table ta_two:
name | active
----------------
john | yes
tina | yes
tina | no
mike | no
The goal I want to achieve is the following: I want to update the column "active" in the first table ta_one with the value of the column "active" from the second table ta_two under the following conditions:
- the name in column "name" in ta_one matches the "name" in ta_two (e.g.: mike and mike)
- if there is more than one entry of the same name in ta_two, no update should happen (e.g.: tina)
- if there is not a "no" in the column active in table ta_two, no update should happen (e.g.: john)
So the table ta_one should look like this after the update:
name | active
----------------
john | yes
tina | yes
mike | no
Only mike's entry has changed, because tina is more than one time in the second table and johns entry has a 'yes' in the active column of table ta_two.
Thank you in advance for the help.