Oracle sql rownum之间如何收缩查询
我想要25到50张的唱片。我写了这段代码,但是,使用double-select子句看起来很糟糕Oracle sql rownum之间如何收缩查询,sql,oracle,oracle11g,pagination,Sql,Oracle,Oracle11g,Pagination,我想要25到50张的唱片。我写了这段代码,但是,使用double-select子句看起来很糟糕 Select * From ( Select eto.*, rownum rn from employee_trip_orders eto ) where rn between 25 and 50 ; 我如何缩小它以使用一个这样的选择 Select eto.*, eto.rownum rn from employee_trip_orders eto where rn between 25
Select * From (
Select eto.*, rownum rn from employee_trip_orders eto
) where rn between 25 and 50 ;
我如何缩小它以使用一个这样的选择
Select eto.*, eto.rownum rn from employee_trip_orders eto
where rn between 25 and 50 ;
我不需要第二个。谢谢我有旧的11c Oracle版本,offset关键字不适合我
我如何缩小它以使用一个这样的选择
因为您使用的是Oracle 11g,所以不能。必须使用子查询内联以实现所需的输出
该查询永远不会返回行。ROWNUM值仅在赋值后递增。请看
从Oracle 12c开始,您可以使用新功能。您没有使用order by子句,那么rownum的含义是什么?最后,您只能随机获取26条25-50条记录
因此,您可以使用以下代码实现所需的结果:
Select eto.*, rownum rn
from employee_trip_orders eto
where rownum<= 26 ;
干杯 你就是不能。第一个查询是您不想使用子查询的唯一方式任何特定原因?使用此查询还可以选择所有列名,rn表单选择eto.*,rownum rn从员工、旅行、订单中选择eto,其中rn
Select eto.*, rownum rn
from employee_trip_orders eto
where rownum<= 26 ;