I am kind of new to postgres and have to insert a bulk data into a table.
I have a query like this:
INSERT into MAINTABLE(COL1,COL2,COL3,COL4,COL5,COL6)
(SELECT a,a1 FROM WRKTABLE1 WHERE a in (SELECT a1 from WRKTABLE2)) X,
(SELECT b, c FROM WRKTABLE3) Y,
(SELECT d,e,f FROM WRKTABLE4) Z
WHERE Y.b = X.a1 AND Y.b = Z.d
Number of rows in Work tables above are as follows: