Hello, I am just trying to understand the logic behind this. Below are two example tables.
TABLE TEAM
NAME COLOR
Bob Blue
Jill Blue
Fred Red
TABLE REF
PERSON
Jill
I want to update TEAM so any name that appears in REF is updated to Red.
Here is the query:
UPDATE TEAM
SET COLOR = 'Red'
WHERE NAME IN (
SELECT PEOPLE FROM REF
)
Note that PEOPLE is not a valid column in REF. If you run the nested select query it will bring an error. However, if you run the entire update statement, it will update ALL records to Red.
Can anyone explain the logic behind this?
Thanks!