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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -