happyzbo9118 发表于 2007-08-07 16:59

informix请教一sql语句

informix请教一sql语句:
update tmp1
Set no = c.no, name = c.name
From tmp1 a
inner join T1 b on a.PNo = b.PNo
inner join T2 c on b.GrNo = c.GrNo
where class = '01'
and no is null

这样的语句在sqlserver下可以运行,请问informix下
update table set ------ from table 可不可以?

如果不可以,上面应该如何修改才可执行,谢谢啦!

东西仓库 发表于 2007-08-08 10:13

小弟试写了一个 希望各位大侠多指点
update   tmp1   set no =   
         ( select t2.no from t2 inner join t1 on t1.GrNo = t2.GrNo
            inner join tmp1 on tmp1.PNo = t1.PNo whereclass = '01' and no is null)
where exists   
          ( select t2.no from t2 inner join t1 on t1.GrNo = t2.GrNo
          inner join tmp1 on tmp1.PNo = t1.PNo whereclass = '01' and no is null)

这样写效率不高,如果可能做一下中间转换,也不会这样复杂。

happyzbo9118 发表于 2007-08-08 13:09

看了,是比较复杂些,但也是一思路,多谢了兄弟!
页: [1]
查看完整版本: informix请教一sql语句