我有一系列数据需要每小时汇总数据
我可以使用具有显示值的excel数据透视表->运行总输入量
CREATE TABLE `rawData` (
`ID` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`StartTime` datetime(0) NULL DEFAULT NULL,
`Duration` decimal(10, 2) NULL DEFAULT NULL,
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 23 CHARACTER SET = latin1 COLLATE = latin1_swedish_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of rawData
-- ----------------------------
INSERT INTO `rawData` VALUES (1, '2019-05-28 01:28:17', 10.00);
INSERT INTO `rawData` VALUES (2, '2019-05-28 01:30:31', 20.00);
INSERT INTO `rawData` VALUES (3, '2019-05-28 02:27:15', 10.00);
INSERT INTO `rawData` VALUES (4, '2019-05-28 02:30:23', 20.00);
INSERT INTO `rawData` VALUES (5, '2019-05-28 02:30:28', 30.00);
INSERT INTO `rawData` VALUES (6, '2019-05-28 03:27:42', 10.00);
INSERT INTO `rawData` VALUES (7, '2019-05-28 03:27:09', 20.00);
INSERT INTO `rawData` VALUES (8, '2019-05-28 03:29:44', 30.00);
INSERT INTO `rawData` VALUES (9, '2019-05-28 03:20:12', 40.00);
INSERT INTO `rawData` VALUES (10, '2019-05-28 04:27:52', 10.00);
INSERT INTO `rawData` VALUES (11, '2019-05-28 04:30:32', 20.00);
INSERT INTO `rawData` VALUES (12, '2019-05-29 01:28:17', 10.00);
INSERT INTO `rawData` VALUES (13, '2019-05-29 01:30:31', 20.00);
INSERT INTO `rawData` VALUES (14, '2019-05-29 02:27:15', 10.00);
INSERT INTO `rawData` VALUES (15, '2019-05-29 02:30:23', 20.00);
INSERT INTO `rawData` VALUES (16, '2019-05-29 02:30:28', 30.00);
INSERT INTO `rawData` VALUES (17, '2019-05-29 03:27:42', 10.00);
INSERT INTO `rawData` VALUES (18, '2019-05-29 03:27:09', 20.00);
INSERT INTO `rawData` VALUES (19, '2019-05-29 03:29:44', 30.00);
INSERT INTO `rawData` VALUES (20, '2019-05-29 03:20:12', 40.00);
INSERT INTO `rawData` VALUES (21, '2019-05-29 04:27:52', 10.00);
INSERT INTO `rawData` VALUES (22, '2019-05-29 04:30:32', 20.00);
预期结果
date sumDuration
2019-5-28 1:00:00 30
2019-5-28 2:00:00 90
2019-5-28 3:00:00 190
2019-5-28 4:00:00 220
2019-5-29 1:00:00 30
2019-5-29 2:00:00 90
2019-5-29 3:00:00 190
2019-5-29 4:00:00 220