My question is how to assosciate to key1&key2 of Table1 to the field price1 in Table2 if key1&key2 exists also in Table2, while associate the field price2 in Table3 (by the field key1) if key1&key2 does not exist in Table2, without generating loops between tables.
when you do a mapping load the data from the original load is not stored in the qvw document.
The "mapping" keyword before the load causes a temporary table - which exists for the duration of the script run - to be created. these tables always have just the two columns.
If you need information from the tables 2 and 3 - such as your price list - you can load them as ordinary tables. You can do this prior to creating the mapping table (preferable) as you have only to read your external Data source once.
You would then create your mapping table with code as follows
load x, y
You probably can find a solution whereby you find your price dynamically - as opposed to my solution which has added the correct price to table1. The advantage of doing it in the script is to make all your expressions much simpler, which is helpful for performance and I'd argue future maintenance.