oracle rank

oracle中 没有入sql server的top,但是可以用rank | percent_rank | row_number | dense_rank等等函数来完成,

如我要取我查询结构的前百分之80的数据:

 

 

select count(*) from(
SELECT t.finishtime - t.receivetime laboredtime,
       percent_rank() over(ORDER BY(t.finishtime - t.receivetime)) rn,
       t.receivetime
  FROM losi_token t, losd_node tn, losd_process tp
 WHERE t.node_id = tn.node_id
   AND tn.process_id = tp.process_id
   AND tn.nodename = '员工日报输入'
   AND tp.processname = '员工日报子流程'
   AND t.receivetime > to_date('2011-08-22 ', 'yyyy-mm-dd hh24:mi:ss')
   AND t.receivetime < to_date('2012-08-06', 'yyyy-mm-dd hh24:mi:ss')
) where rn <0.8

你可能感兴趣的:(oracle,top,rank,row_number,percent_rank)