Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I load new data every day and need not just concatenate it to previous one, but also make changes in old data according to a new data. Here is an example of tables
load * Inline [
a, b
1,2
2,3
3,8
];
load * Inline [
a, b
1,5
2,3
4,3
5,4
];
As a result of joining/concatenating them I would like to have
a, b
1,5
2,3
3,8
4,3
5,4
How can I do that?
Try loading in the following order:
load * Inline [
a, b
1,5
2,3
4,3
5,4
];
Concatenate
load * Inline [
a, b
1,2
2,3
3,8
]
where not exists(a);
Here it is:
A:
NoConcatenate
load * Inline [
a, b
1,2
2,3
3,8
];
B:
NoConcatenate
load * Inline [
a, b
1,5
2,3
4,3
5,4
];
AB:
NoConcatenate
LOAD * Resident A;
Concatenate
LOAD * Resident B;
DROP Tables A, B;
Left Join
LOAD a, Max(b) as M Resident AB Group by a;
Final:
NoConcatenate
LOAD * Resident AB Where M = b;
DROP Table AB;
Can you try this
A:
load * Inline [
a, b
1,2
2,3
3,8
];
Concatenate
B:
load * Inline [
a, b
1,5
2,3
4,3
5,4
];
NoConcatenate
AB:
load distinct a, b
Resident A;
drop table A;
Thanks Alessandro!
But what if values are not numbers, or number which become both less or more. In final table should be value from second load, not matter what there
Result will be
1,2
1,5
2,3
3,8
4,3
5,4
Try loading in the following order:
load * Inline [
a, b
1,5
2,3
4,3
5,4
];
Concatenate
load * Inline [
a, b
1,2
2,3
3,8
]
where not exists(a);
You mean the result should be Ordered??
I get exactly the way you asked for the code snippet post my me earlier. Plz. see the screen shot.
I meant that should be unique "a" values, and "b" values from the latest load
It works! Thank you.
Could you please explain how this "where not exists(a)" statement works here?