例子如下:
CREATE TEMPORARY TABLE NEW_TIME_CLIENT(UUID VARCHAR(36), CLIENT_MAC
VARCHAR(17), ONLINE_SECONDS INT)
ENGINE=MEMORY;
SET @SQL_NEW_TIME_CLIENT=CONCAT("
INSERT INTO NEW_TIME_CLIENT
SELECT UUID, SUBSTRING(RVALUE,1,17) CLIENT_MAC, SUBSTRING(RVALUE,19)
ONLINE_SECONDS FROM
(
SELECT * FROM VALUE_DETAIL_5_42_",@CUR_DAY,"
WHERE RPTTIME BETWEEN ‘",@TIME1,"‘ AND ‘",@TIME2,"‘) R
WHERE RITEM LIKE ‘client%‘;");
PREPARE SQL_NEW_TIME_CLIENT FROM @SQL_NEW_TIME_CLIENT;
EXECUTE SQL_NEW_TIME_CLIENT;
时间: 2024-10-05 08:52:57