My query below spools out becuase of large volume of data. Can there be a fix to this?
INSERT INTO table1 SELECT col1, C.CYCL , MIN(col3) FROM table2 A INNER JOIN table3 B ON A.BID = B.BID INNER JOIN table4 C ON B.BID = C.BID AND C.CYCL IS NOT NULL WHERE A.FLG<>'D' GROUP BY 1,2;
Bascially there is only one column on which we can join each of these tables which is BID. And for each BID, the table4 has multiple rows. There are 5 million records in table4 and 3 million each table3 and table2.