update jg_jbxx_xml set  bzl='2'where (select * from (select * from jg_jbxx_xml where bzl='1' order by LRSJ desc) where rownum<=2) 是吧 查询出来的着两行 数据里面的 bzl='1' 更新成 bzl='2' 求高手赐教

解决方案 »

  1.   


    update select *
             from (select * from jg_jbxx_xml where bzl = '1' order by LRSJ desc) rownum <= 2 set bzl = '2'
      

  2.   


    ------加个括号update (select *
              from (select * from jg_jbxx_xml where bzl = '1' order by LRSJ desc) rownum <= 2)
       set bzl = '2'
      

  3.   

    --试试
    update jg_jbxx_xml j set j.bzl='2'
    where (select * from 
            (select * from jg_jbxx_xml where bzl='1' order by LRSJ desc) t
          where rownum<=2 and j.主键=t.主键)  
      

  4.   

    update jg_jbxx_xml set bzl='2' from  (select * from (select * from jg_jbxx_xml where bzl='1' order by LRSJ desc) where rownum<=2)   as a
      

  5.   

    update (select *
              from (select * from jg_jbxx_xml where bzl = '1' order by LRSJ desc) rownum <= 2)
       set bzl = '2'
    这个不能用  出来的错误是 操作非法.........
      

  6.   

    楼上的 级给出的 语句不能正确结束啊 请问是怎么回事啊
    update jg_jbxx_xml set bzl='2' from (select * from (select * from jg_jbxx_xml where bzl='1' order by LRSJ desc) where rownum<=2) as a
      

  7.   

    update jg_jbxx_xml j1 set bzl= (select '2' from (select * from jg_jbxx_xml where bzl='1' where rownum<=2 order by LRSJ desc ) j2 where j2.主键=j1.主键);
    把‘主键’改成你表里的主键
      

  8.   


    update jg_jbxx_xml set bzl='2'
    where col in (select col from (select col from jg_jbxx_xml where bzl='1' order by LRSJ desc) where rownum<=2)--or
    update (select bzl from (select bzl from jg_jbxx_xml where bzl='1' order by LRSJ desc) where rownum<=2)
    set bzl='2'
      

  9.   

    update (select *
              from (select * from jg_jbxx_xml where bzl = '1' order by LRSJ desc) rownum <= 2)
       set bzl = '2'这个方法应该可以吧?
      

  10.   

    -- 没有主键的话,用rowid来更新(给个例子给你):update emp t1 
    set t1.sal=3000
    where rownum in ( select rowid 
                   from ( select t2.rowid, t2.empno, t2.sal from emp t2 where t2.deptno=30 order by t2.sal desc) t3 
                   where rownum<=2 );
      

  11.   

    update jg_jbxx_xml set bzl='2'where  bzl='1' and  rownum<=2
    你那个order by 有点恶心。
      

  12.   

    -- 上面写错啦,修正一下:
    update emp t1 
    set t1.sal=3000
    where rowid in ( select rowid 
                   from ( select t2.rowid, t2.empno, t2.sal from emp t2 where t2.deptno=30 order by t2.sal desc) t3 
                   where rownum<=2 );
      

  13.   


    ------试试看。。
    update jg_jbxx_xml
       set bzl = '2'
     where rowid in (select rowid
                       from (select *, rowid
                               from jg_jbxx_xml
                              where bzl = '1'
                              order by LRSJ desc) rownum <= 2)
      

  14.   

    update jg_jbxx_xml
    set bzl='2'
    where rowid in (select rowid 
                    from (select t1.rowid from jg_jbxx_xml where bzl='1' order by lrsj desc) t 
                    where rownum<=2);
      

  15.   

    update jg_jbxx_xml
    set bzl='2'
    where rowid in (select rowid 
                    from (select t1.rowid from jg_jbxx_xml t1 where t1.bzl='1' order by t1.lrsj desc) t 
                    where rownum<=2);
      

  16.   

    谢谢 各位 兄弟么  但是 我要把查出的那两行数据 放到 dateset里面 做数据的啊 要是按照你们那么改的 话就 不能查到数据了啊 
      

  17.   

    和简单 就是 查询出来两个 数据 给一个dateset 生成一个XML 文件 当 然后在把 这两条数据里面的 bzl列的值变成 2 就可以了