On one of my scripts I use to copy over data to a temporary table is inefficient,
Everything works fine BUT importing the data into our accountancy program is very slow.
This is because of the inefficient way I'm copying over the data to the temporary table.
An example output file looks like this :-
As you can see there are plenty of the same product code going across.
My method is basically searching against the order to find the related components. Then i loop through each component line and copy over certain information to the temporary table.
How could I change it so that when I find the related components, it also does a find / loop on the product codes within the related list and only enters one line into the temporary table with the total quantity of the found product codes.