Using the result of a query as a table name

2019-03-06 02:35发布

问题:

If we have table A as follows:

+-------+
+ Table +
+-------+

How would one perform a query involving values of A.table as the table name?

What I mean is something along the lines of this:

SELECT "Table" as "tbl" FROM "A";
SELECT * FROM "tbl";

but in one statement.

回答1:

SQLite has no built-in mechanism to construct SQL statements dynamically; this is not possible.

(There is the eval extension, but it is not part of the default distribution.)



标签: sql sqlite3