Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have the following problem:
I have two tables:
Table1:
Date | Amount |
01.10.2011 | 1 |
02.10.2011 | 2 |
03.10.2011 | 3 |
Table2:
Date | Amount |
02.10.2011 | 5 |
Now I want to load the two tables, so that I get one table (Table1) with the following result:
Table1:
Datum | Wert |
01.10.2011 | 1 |
02.10.2011 | 5 |
03.10.2011 | 3 |
Can anyone help me!
Thanks
Hi,
See the solution sheet by the use of LastValue( ) you can achieve it.
Load a data some thing like
Table1:
load * inline
[
Date, Amount
01.10.2011, 1
02.10.2011, 2
03.10.2011, 3
];
Join
load * inline
[
Date, Amount
02.10.2011, 5
];
load
LastValue(Amount) as LastVal,
Date
Resident Table1
group by Date;
drop table Table1;
If you not require Table1 so drop it or if you want to keep it so do not delete it.
Rgds
Anand
Hi,
Just simpley load this two tables.
Rgds
Anand
Hi,
when I'm only load the two tables, I get the following result:
Table1:
Date | Amount |
01.10.2011 | 1 |
02.10.2011 | 2 |
02.10.2011 | 5 |
03.10.2011 | 3 |
But the Amount 2 on 02.10.2011 must be overwritten by Amount 5 on 02.10.2011 from table2.
Hi,
See the solution sheet by the use of LastValue( ) you can achieve it.
Load a data some thing like
Table1:
load * inline
[
Date, Amount
01.10.2011, 1
02.10.2011, 2
03.10.2011, 3
];
Join
load * inline
[
Date, Amount
02.10.2011, 5
];
load
LastValue(Amount) as LastVal,
Date
Resident Table1
group by Date;
drop table Table1;
If you not require Table1 so drop it or if you want to keep it so do not delete it.
Rgds
Anand
Hi Anand,
thank you very much for the example and the quick answer!!
That's the solution.
Chris