今晚很好奇想知道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