select a.*, sum(a.`委单金额`) over(partition by a.年 order by a.月) as 月度累计 from ( select YEAR(委单时间) as 年, MONTH(`委单时间`) as 月, sum(`委单金额`) as `委单金额` FROM z_clientorder group by YEAR(委单时间), MONTH(`委单时间`) ) AS a 我觉得我的语句没有写错啊,但是总是提示错误1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(partition by a.年 order by a.月) as 月度累计 |