题解 | #统计salary的累计和running_total#
统计salary的累计和running_total
http://www.nowcoder.com/practice/58824cd644ea47d7b2b670c506a159a6
窗口函数使用,确保严谨外面order by不能省略,窗口函数排序只对计算新字段有作用
select emp_no,sum(salary), sum(sum(salary)) over(order by emp_no) from salaries where to_date='9999-01-01' group by emp_no order by emp_no;