SELECT a.*,RANK() OVER(PARTITION BY col2 ORDER BY col1) "Rank" from table a;
oracle分析函数十分强大,我们只要掌握这些方法,更直接的说法就是知道这些分析函数的作用就能完成很多工作。
http://www.ej38.com/showinfo/Oracle-187217.html
select odrd141_dcpurd.odrd141_orderno,
RANK() OVER(PARTITION BY odrd141_orderno ORDER BY odrd141_lineno) haha
from odrd141_dcpurd
order by ODRD141_ORDERNO, haha
RANK() OVER(PARTITION BY odrd141_orderno ORDER BY odrd141_lineno) haha
from odrd141_dcpurd
order by ODRD141_ORDERNO, haha