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 |
+-------+