SELECT *, Row_Number() OVER (partition by deptid ORDER BY salary desc) rank FROM employee
Row_Number()显示行号,加上partition by还能分组排序显示行号。
就这么一句sql,每次忘记这个Row_Number()回头一看就什么都明白了。
posted on 2016-10-21 15:58  vinsonLu  阅读(632)  评论(0编辑  收藏  举报