mysql-行累计
2017-07-04 本文已影响0人
cure_py
http://blog.sina.com.cn/s/blog_82bc42b10106dhve.html
单行累计:比如:col2=col1+col2;col3 = col1+col2+col3……
在我们需要把twg_energy_quantity 这一列按照日期累计求和

select
(select sum(twg_energy_quantity) from tmp where t.twg_program_date >=twg_program_date)sum_quantity,
t.twg_energy_quantity,t.twg_program_date from tmp t ;
