update Informix table with joins

前端 未结 5 967
执笔经年
执笔经年 2021-01-17 14:35

Is this the correct syntax for an Informix update?

update table1
set table1.code = 100
from table1 a, table2 b, table3 c
where a.key = c.key
a.no = b.no
a.ke         


        
5条回答
  •  自闭症患者
    2021-01-17 14:51

    Unfortunately, the accepted answer causes syntax error in Informix Dynamic Server Version 11.50.

    This is the only way to avoid syntax error:

    update table1
    set code = (
      select 100
      from table2 b, table3 c
      where table1.key = c.key
      and table1.no = b.no
      and table1.key = c.key
      and table1.code = 10
      and b.tor = 'THE'
      and table1.group = 4183
      and table1.no in ('1111','1331','1345')
    )
    

    BTW, to get Informix version, run the following SQL:

    select first 1 dbinfo("version", "full") from systables;
    

    Updated: also see this answer.

    Updated: also see the docs.

提交回复
热议问题