Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
TABLE A | ||||
Key | Field1 | Field2 | Field3 | |
1 | alfa | 45 | 2 | |
3 | beta | 23 | 7 | |
4 | gamma | 7 | 5 | |
5 | delta | 23 | 3 | |
TABLE B | ||||
Key | Field4 | |||
1 | milano | |||
4 | torino | |||
FINAL TABLE | ||||
Key | Field1 | Field2 | Field3 | Field4 |
1 | alfa | 45 | 2 | milano |
3 | beta | 23 | 7 | |
4 | gamma | 7 | 5 | torino |
5 | delta | 23 | 3 |
load *
from Table A
join
load *
from Table B
Note this only works when the tables share a common key and field name; Qlik automatically joins on field name
Hi @mauvasco62 ,
The other guys have already helped you with what is probably the easiest answer. Another approach to consider in this instance is to use a mapping load. This is essentially what people often call a "lookup" of a value. This approach is often preferred in circumstances where a value is being mapped to another one, such as mapping an ID field to a description as it is more efficient that a join and can be simpler. It won't help you in scenarios where you want to add more than one field at a time from
// Create the mapping table
map1:
mapping load Key, Field4
Table B;
// Apply the map to add the new column to your table A
TableA:
Load *,
ApplyMap('map1', Key, null()) as Field4
Table A;
Note that I've used a default value of null() for Field4 in cases where there isn't a Key field match, but you can put whatever you like in there as a default value.
And just to confuse matters you could play with forced concatenation of the tables, but that's probably not what you are after in this instance.
Cheers,
Rod