Question: I have an update query like following:

```
update table TABLE1 set COL1 = 'X' where COL2 = 'Y' ---1

```

Support the values 'X' and 'Y' are fetched from database now TABLE2. E.g.

```
select COL1, COL2 from TABLE2. ----2

```

I want to update table TABLE1 with values from TABLE2. 

Just to make it more clear, assume that TABLE2 has following values:

![alt text](https://i.stack.imgur.com/b1rfu.jpg)

Can you please help me in doing this in a single query!

I am using Oracle 11g.

Answer: 
@Dave Costa's answer is correct, if you limit yourself to `update` statements. However, I've found that using a `merge` statement in these situations allows me to do this in a more straightforward manner:

```
merge into TABLE1 
      using TABLE2 
      on (TABLE2.COL2 = TABLE1.COL2)
when matched then
     update set TABLE1.COL1 = TABLE2.COL1;

```
```
update TABLE1 
set TABLE1.COL1 = TABLE2.COL1
from TABLE1
join TABLE2 on TABLE1.COL2 = TABLE2.COL2

```

(this would work on Sql Server)