postgresql: INSERT INTO … (SELECT * …)
I'm not sure if its standard SQL: INSERT INTO tblA (SELECT id, time FROM tblB WHERE time > 1000) What I'm looking for is: what if tblA and tblB are in different DB Servers . Does PostgreSql gives any utility or has any functionality that will help to use INSERT query with PGresult struct I mean SELECT id, time FROM tblB ... will return a PGresult* on using PQexec . Is it possible to use this struct in another PQexec to execute an INSERT command. EDIT: If not possible then I would go for extracting the values from PQresult* and create a multiple INSERT statement syntax like: INSERT INTO films