Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I've below two tables
Table1:
ID | Value |
1 | Name1 |
2 | Name2 |
left join(Table1)
ID | ID1 | Test |
1 | 100 | |
2 | 200 | Name2 |
Mapping Table:
Mapping Load ID, Test
resident Table1
So I'm looking for an apply map function where if field 'Test' is empty it has to pick from field 'Value' or else from 'Test'. Below is the output which I'm expecting.
ID | ID1 | New Field |
1 | 100 | Name1 |
2 | 200 | Name2 |
Maybe in this way:
m: Mapping Load ID, Test from Table1;
t2: load ID, ID1, if(len(trim(Test)), Test, applymap('m', ID, 'no match')) as Value from Table2;
thanks for that, actually we don't have table2, I've modified the question.
It's not really clear which tables and data are existing or not?