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' 求高手赐教
update select * from (select * from jg_jbxx_xml where bzl = '1' order by LRSJ desc) rownum <= 2 set bzl = '2'
------加个括号update (select * from (select * from jg_jbxx_xml where bzl = '1' order by LRSJ desc) rownum <= 2) set bzl = '2'
--试试 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.主键)
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
update (select * from (select * from jg_jbxx_xml where bzl = '1' order by LRSJ desc) rownum <= 2) set bzl = '2' 这个不能用 出来的错误是 操作非法.........
楼上的 级给出的 语句不能正确结束啊 请问是怎么回事啊 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
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.主键); 把‘主键’改成你表里的主键
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'
update (select * from (select * from jg_jbxx_xml where bzl = '1' order by LRSJ desc) rownum <= 2) set bzl = '2'这个方法应该可以吧?
-- 没有主键的话,用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 );
update jg_jbxx_xml set bzl='2'where bzl='1' and rownum<=2 你那个order by 有点恶心。
-- 上面写错啦,修正一下: 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 );
------试试看。。 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)
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);
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);
update select *
from (select * from jg_jbxx_xml where bzl = '1' order by LRSJ desc) rownum <= 2 set bzl = '2'
------加个括号update (select *
from (select * from jg_jbxx_xml where bzl = '1' order by LRSJ desc) rownum <= 2)
set bzl = '2'
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.主键)
from (select * from jg_jbxx_xml where bzl = '1' order by LRSJ desc) rownum <= 2)
set bzl = '2'
这个不能用 出来的错误是 操作非法.........
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
把‘主键’改成你表里的主键
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'
from (select * from jg_jbxx_xml where bzl = '1' order by LRSJ desc) rownum <= 2)
set bzl = '2'这个方法应该可以吧?
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 );
你那个order by 有点恶心。
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 );
------试试看。。
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)
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);
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);