Hi,

I really need your help. I have some problems with implementing an Update of 
special rows in one of my tables:

I have the following tables:

"T1" with fields called "id" and "value"

and a table "T2" with the fields "id" and "value"

I want to update T1.value with T2.value where T1.id = T2.id,

but only if the T2 contains the id.

Here is the example:

 

T1:

id, value

1, 'A'

2, 'B'

3, 'C'

 

T2:

id, value

2, 'X'

 

After the update T1 should be

id, value

1, 'A'

2, 'X'

3, 'C'

I first tried

UPDATE "T1" SET "value" = (SELECT "T2"."value" FROM "T2" WHERE "T1"."id" = 
"T2"."id")

 

But here all rows (exept id=2) are set to NULL.

I think this is not a very complex problem but I need a advice how to solve it.

 

Thanks for any help or advice

Phil



Verschicken Sie romantische, coole und witzige Bilder per SMS! 
Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193 

Reply via email to