select - PostgreSQL: update tabA with a selection from tabB and tabC -


i've selection in tabc. i've applied selection tabb. i've update taba values these 2 selections.

select on tabc , tabb:

select * tabc id_field in   (select id_field tabb date_in = '2011-02-22') order id_field 

update taba:

update taba set field_1 = tabc.field_1, field_2 = tabc.field_2, field_2 = tabc.field_2 tabc taba.id_field in   (select tabc.id_field tabc tabc.id_field in     (select id_field tabb date_in = '2011-02-22')) 

the update statement runs without error result not i'd expeted: 3 fields have same values rows. what's wrong?

use inner join instead

update taba    set field_1 = tabc.field_1,        field_2 = tabc.field_2,        field_3 = tabc.field_3    tabc        inner join tabb on tabc.id_field = tabb.id_field , tabb.date_in = '2011-02-22'  taba.id_field = tabc.id_field; 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -