本帖最后由 zhuhonghong 于 2010-11-09 17:11:23 编辑

解决方案 »

  1.   

    ;with cte as
    (select min(col2) minCol2,max(col2) maxCol2 from tb
    )
    update cte set col2=case when col2=minCol2 then maxCol2+mincol1 end from Cte,Tb 
      

  2.   

    update tb
    set 字段2=(select max(字段2) from tb)+1
    where 字段1='X'select * from tb where 字段1='X'2句
      

  3.   

    js_szy 说的对
    update tb set col2=(select max(col2)+1 from tb) where col1='X'
    在oracle测试过,靠,第一次测试居然通过不了,撞邪了我
      

  4.   

    要一句sql搞定的,现在就是用两句描述的,想改成一句的。
      

  5.   

    自己顶一下,因为想把 update后的结果值取出来放到insertinto语句中,所以想把这两句话的sql语句用一句话表达出来。不知道有没有可能呢?
      

  6.   

    ;with cte as
    (select *,rowid=row_number() over(order by col2 desc) from tb where col1='X'
    )
    update cte set col2=(select max(col2)+1 from tb)
      

  7.   

     
    最后发现是自己问错了问题。不可以用一句话表述上述问题,必须用两句sql语句才能写出