题解 | #统计salary的累计和running_total#
统计salary的累计和running_total
http://www.nowcoder.com/practice/58824cd644ea47d7b2b670c506a159a6
select s1.emp_no,s1.salary,
(@sum_:=@sum_+s1.salary) as running_total
from salaries s1,( SELECT @sum_:= 0) AS t
(@sum_:=@sum_+s1.salary) as running_total
from salaries s1,( SELECT @sum_:= 0) AS t
where s1.to_date = '9999-01-01' order by s1.emp_no
为什么这个通过不了呢?running_total无法取整,奇怪了