数据库
首页 > 数据库> > mysql数据逐渐累加

mysql数据逐渐累加

作者:互联网

SELECT  year_month_val, xun, flux, ROUND(@temp:=@temp+flux,4) AS yearVal FROM 
(SELECT  year_month_val, xun, SUM(flux)flux FROM wrs_muw_plan WHERE manage_id = 568 AND year_month_val BETWEEN '2020-09-01' AND '2021-09-01' 
GROUP BY year_month_val, xun ORDER BY year_month_val ASC, field(xun,'上旬','中旬','下旬'))a,(SELECT @temp:=0)T
 

标签:逐渐,val,mysql,month,flux,year,xun,累加,SELECT
来源: https://www.cnblogs.com/qwer78/p/16191369.html