Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
table1: table2:
bar value bar value
1 raj 1 null
2 null 3 null
4 ren 4 null
5 null 6 null
I want merge this 2 tables and fetch the unique values..
excepted output:
bar value
2 null
3 null
5 null
6 null
Hi there,
This seems not to be doable with a join or keep function. Therefore, an alternative is to work in steps :
- first I'd join both tables
- then create a mapping table, that counts the number of occurencies of 'bar'
- then apply the mapping on the initial table
- and to end, reload this mapped table, only taking into consideration where the mapping variable = 1
Regards,
Johan
Hi johan,
Thank you for replay....I can't understand wat u r saying..
can u explain briefly with script...
regards
ravi.
Hello Ravi,
That would look like :
100:
LOAD
bar,
value
FROM table 1
concatenate
LOAD
bar,
value
FROM table2
Map_count:
MAPPING LOAD
bar,
COUNT(bar)
RESIDENT 100
group by bar;
200:
LOAD *
Applymap('Map_count', bar) as count
RESIDENT 100;
DROP TABLE 100;
300:
LOAD *
RESIDENT 200
WHERE count = 1;
DROP TABLE 200;
Regards,
Johan
Thanks Johan,
but it's not working properly.
correct answer:
tabl1:
load bar,
value from tabl1 where not exists(bar);
concatinate
load bar,
value from table2;
Hi ALL,
in above requirement I want fectch only duplicate values.
excepted output:
bar value
1 raj
1 null
4 ren
4 null