先对结果集排序然后做update、delete操作

mac2022-06-30  113

--先排序然后删除第n条数据delete from scott.emp where empno in (select empno                   from (select *                           from scott.emp                          where comm is null                            and rownum < 2                          order by hiredate desc));--先排序然后更新第n条数据update scott.emp                                     set comm = 123                                  where empno in (select empno                                        from (select empno                                        from scott.emp                                   where rownum < 2                                    and comm is null                                order by hiredate asc));

转载于:https://www.cnblogs.com/iyoume2008/p/6935149.html

最新回复(0)