RESULT_SCAN
返回同一会话中前一个命令的结果集,就像该结果是一个表一样。
语法
RESULT_SCAN( { '<query_id>' | LAST_QUERY_ID() } )
示例
创建一个简单的表:
CREATE TABLE t1(a int);
插入一些值:
INSERT INTO t1(a) VALUES (1), (2), (3);
result_scan
SELECT * FROM t1 ORDER BY a;
+-------+
| a |
+-------+
| 1 |
+-------+
| 2 |
+-------+
| 3 |
+-------+
SELECT * FROM RESULT_SCAN(LAST_QUERY_ID()) ORDER BY a;
+-------+
| a |
+-------+
| 1 |
+-------+
| 2 |
+-------+
| 3 |
+-------+