oravle 视图

    xiaoxiao2021-12-14  22

    --查找工资在40-到50名的员工 ,rownum 不能用>或者>=,否则将不返回结果 --如下例子将不返回 任何结果 select rownum, last_name ,salary,employee_id from ( select last_name,salary,employee_id from employees order by salary desc)  where rownum <50 and rownum > 40;  可以变通使用,将rownum通过别名的方式,让外层来引用它,就不会有不能使用>而不出结果的情况  select rn ,last_name,salary,employee_id from (select rownum rn, last_name ,salary,employee_id from (

    select last_name,salary,employee_id from employees order by salary desc))

     where rn <50 and rn > 40;

    注意:对oracle分布,必须使用rownum 伪例。

    rownum不能用>的问题

    http://www.linuxidc.com/Linux/2011-12/49458.htm

    转载请注明原文地址: https://ju.6miu.com/read-969439.html

    最新回复(0)