CREATE DEFINER=`root`@`localhost` PROCEDURE `proc_RealData`(IN `timeBegin` DATETIME, IN `timeEnd` DATETIME, IN `timeInterval` INT)
MODIFIES SQL DATA
SQL SECURITY INVOKER
COMMENT '/*存储过程:按起始、终止时间,以及时间间隔,抽取数据*/'
BEGIN
SET @time := '1000-01-01 00:00:00';
SET @interval := timeInterval;
SELECT * FROM em_air_humidity
WHERE `em_air_humidity`.`DateTime` >= timeBegin AND `em_air_humidity`.`DateTime` <= timeEnd
AND TIMESTAMPDIFF( SECOND, @time, `em_air_humidity`.`DateTime` ) >= @interval
AND @time := `em_air_humidity`.`DateTime`;
END