码迷,mamicode.com
首页 > 移动开发 > 详细

Oracle ->> Oracle下实现SQL Server的TOP + APPLY

时间:2015-07-08 01:56:00      阅读:166      评论:0      收藏:0      [点我收藏+]

标签:

今晚很好奇想知道Oracle下有没有APPLY子句?如果有那怎么实现SQL Server下的TOP + APPLY。结果自己写了个例子。

with a as (
select grp_factor from (select distinct grp_factor from numbers where id < 10 order by grp_factor) t 
where rownum <= 5)

select b.id, a.grp_factor
from a cross apply(select id from (select id from numbers b where a.grp_factor = b.grp_factor order by id) t where rownum<=3)b

 

Oracle ->> Oracle下实现SQL Server的TOP + APPLY

标签:

原文地址:http://www.cnblogs.com/jenrrychen/p/4628920.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!