Let’s say, I have already loaded a table with some sales headers. Then, I would like to get one column to map it onto another table,which is not directly linked to the sales headers. My solution is just to load it again with MAPPING LOAD statement.
However, I suppose there should be a simplier and more effective approach to this task. Do you have any ideas how I can make it working? How not to load the same table again?
Lines://fetching all invoice headers from CustInvoiceJour table
I don't see anything wrong with that, and I don't see any simpler way to work that around other than, perhaps, joining both tables. Depending on the values, it may take a huge amount of time and memory, and probably it's not worth it.
But if you are loading dozens of thousands of rows, you may give a try to first STORE the fields you want into a QVD file then load from this QVD. If the load is optimized, it should be quite faster than the RESIDENT load. As it's a mapping table, there's not need to rename fields.
Note that from version 10 on you can load mapping tables from optimized QVD files.
Hope that helps.
P.S.: Well, yes, you can do that in the SQL statement, but I don't see any reason to leverage on the RDBM.