Chinaunix

标题: informix 中如何更新选出的数据第一行 [打印本页]

作者: SexyPipe    时间: 2004-09-02 13:24
标题: informix 中如何更新选出的数据第一行
我想更新从表中按一定的条件选出的数据的第一行,
这句sql该怎么写?


update a
set field01=
(select field02 from a where field01='01' and field02='02')?????


这个子查询该如何写?
作者: amiescort    时间: 2004-09-02 22:54
标题: informix 中如何更新选出的数据第一行
select first field02 from .......
作者: SexyPipe    时间: 2004-09-03 10:33
标题: informix 中如何更新选出的数据第一行
楼上老大,帮忙写全,谢谢!
作者: john_student    时间: 2004-09-03 20:24
标题: informix 中如何更新选出的数据第一行

  1. select first col from tab where ...
  2. ;
复制代码

上面的单独select自然可以,

但在update中作为子句恐怕不行吧???
(我也没测试过,臆断而已)
哪位有环境试试?下面语句会报错吧?

  1. update tab1 set col1 =
  2.   (  select first col2 from tab2 where ... )
  3. ;
复制代码

作者: hiccb    时间: 2004-09-06 11:13
标题: informix 中如何更新选出的数据第一行
我试过了的确是在update 里不能用select first 1 clo2 的!




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2