How to INSERT INTO table from dynamic query?
问题 My version of Postgres is: "PostgreSQL 9.4.4, compiled by Visual C++ build 1800, 32-bit" Let's say I have two tables Table1 and Table2 , which are having column col1 and col2 respectively. CREATE TABLE Table1(col1 int); CREATE TABLE Table2(col2 int); There is another table Table3 storing a formula for migrating data from Table1 to Table2 : CREATE TABLE Table3 ( tbl_src varchar(200), col_src varchar(500), tbl_des varchar(200), col_des varchar(100), condition varchar(500) ); INSERT INTO Table3