mysql分组累计sql问题
nice~! 引用楼上的实践了一下,可达到预期
SELECT MONTH,SUM(money) money,总累计,省内累计,省外累计 FROM
(SELECT MONTH,money
,(SELECT SUM(money) FROM group_total WHERE MONTH >= '201501' AND MONTH = '201501' AND MONTH = '201501' AND MONTH
建表语句
CREATE TABLE `group_total` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'MySQL分组累计SQL',
`month` varchar(255) DEFAULT NULL,
`money` int(11) unsigned DEFAULT '0',
`type` varchar(60) DEFAULT '',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8
赞0
踩0