日期:2014-05-17 浏览次数:20975 次
update tb set date=' ' where id in (select id from (select id,rownum rn from tb order by date) where rn<=10)
------解决方案--------------------
测试数据:
CREATE TABLE T149 ( ID NUMBER(2), MyDaate DATE ); DELETE T149; INSERT INTO T149 VALUES(11, TO_date('2012-03-10', 'YYYY-MM-DD')); INSERT INTO T149 VALUES(22, TO_date('2012-03-01', 'YYYY-MM-DD')); INSERT INTO T149 VALUES(33, TO_date('2012-03-12', 'YYYY-MM-DD')); INSERT INTO T149 VALUES(44, TO_date('2012-03-15', 'YYYY-MM-DD')); INSERT INTO T149 VALUES(55, TO_date('2012-03-04', 'YYYY-MM-DD')); INSERT INTO T149 VALUES(66, TO_date('2012-03-20', 'YYYY-MM-DD'));
------解决方案--------------------
update A set A.date = xxx where exists (select 1 from A where rownum < 11)