Skip to content

Returns the result set of a previous command in same session as if the result was a table.

RESULT_SCAN( { '<query_id>' | LAST_QUERY_ID() } )

Create a simple table:

CREATE TABLE t1(a int);

Insert some values;

INSERT INTO t1(a) VALUES (1), (2), (3);
Terminal window
SELECT * FROM t1 ORDER BY a;
┌───────┐
a
├───────┤
1
├───────┤
2
├───────┤
3
└───────┘
Terminal window
SELECT * FROM RESULT_SCAN(LAST_QUERY_ID()) ORDER BY a;
┌───────┐
a
├───────┤
1
├───────┤
2
├───────┤
3
└───────┘