Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have a little difficult with import and merging data from two different datasources.
In the 1th datasource I have a table like this
ID | Key | Value |
---|---|---|
1 | a | 1 |
2 | b | 1 |
3 | c | 3 |
4 | d | 4 |
5 | e | 4 |
In a 2nd datasource I have another table like this
ID | Value |
---|---|
2 | 2 |
5 | 5 |
Finally, I want to update the value column in the first table using the corresponding int the 2nd one like this
ID | Key | Value |
---|---|---|
1 | a | 1 |
2 | b | 2 |
3 | c | 3 |
4 | d | 4 |
5 | e | 5 |
I wrote this script but it does not work properly.
Fixed:
LOAD
ID
, Value
From
Qvd\Fixed.qvd
(qvd);
Concatenate (Fixed)
LOAD
*
From
Qvd\Source.qvd
(qvd)
Where Not Exists(ID);
Can someone please help me?
Thanks a lot.
Ecco qui'
Ecco qui'
See this Sample script:
Tab1:
LOAD * INLINE [
ID, Key, Value
1, a, 1
2, b, 1
3, c, 3
4, d, 4
5, e, 4
];
Tab2:
LOAD * INLINE [
ID, Value
2,2
5,5
];
Data:
LOAD
ID, Key as KEY, Value
Resident Tab1;
DROP Table Tab1;
Join(Data)
LOAD
ID, Value as Val2
Resident Tab2;
DROP Table Tab2;
FinalData:
LOAD
ID,KEY
,if(IsNull(Val2)=0,Val2,Value) as Value
Resident Data;
DROP Table Data;
Thanks a lot for all responses.
It was what I needed.