DB2 update using inner join -


i want make update statement on db2 table using inner join try

update table1 set fieldvalue='text/html' table1 t1  inner join table2 t2 on t1.profile_id = t2.profile_id  inner join table3 t3 on t2.msgtype_id = t3.msgtype_id  t1.name='contenttype' , t3.name='order'; 

i mention select works fine

select * table1 t1 inner join table2 t2  on t1.profile_id = t2.profile_id  inner join table3 t3 on t2.msgtype_id = t3.msgtype_id  t1.name='contenttype' , t3.name='order'; 

thanks!

db2 doesn't allow "update + join" syntax. but, can rewrite sql (not tested):

update table1 set fieldvalue='text/html'  table1.primary_key in ( (     select t1.primary_key     table1 t1      inner join table2 t2 on t1.profile_id = t2.profile_id      inner join table3 t3 on t2.msgtype_id = t3.msgtype_id      t1.name='contenttype' , t3.name='order' ); 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -