Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

how to avoid sum of field values when joining two tables with identical fields

Hi

I have two tables which I want to join but without summing the values (red). Instead it should just be updated (green). How to do that? Many thanks for your help.

1 Solution

Accepted Solutions
vishsaggi
Champion III
Champion III

Try this:

Table1:

LOAD * INLINE [

TimeStamp1, F1, F2

01.01.2016,1,2

02.01.2016,1,2

03.01.2016,1,2

];

Table2:

LOAD * INLINE [

TimeStamp1, F1, F2

02.01.2016,2,11

03.01.2016,2,11

04.01.2016,2,11

];

NoConcatenate

Final:

LOAD TimeStamp1,

     Max(F2) AS F2,

     Max(F1) AS F1

Resident Table1

Group By TimeStamp1;

Drop Table Table1;

Capture.PNG

View solution in original post

2 Replies
antoniotiman
Master III
Master III

Hi Cristoph,

LOAD * Inline [
Timestamp,F1,F2
02/01/2016,2,11
03/01/2016,2,11
04/01/2016,2,11]
;
Concatenate LOAD * Inline [
Timestamp,F1,F2
01/01/2016,1,2
02/01/2016,1,2
03/01/2016,1,2]

Where not Exists(Timestamp);

Regards,

Antonio

vishsaggi
Champion III
Champion III

Try this:

Table1:

LOAD * INLINE [

TimeStamp1, F1, F2

01.01.2016,1,2

02.01.2016,1,2

03.01.2016,1,2

];

Table2:

LOAD * INLINE [

TimeStamp1, F1, F2

02.01.2016,2,11

03.01.2016,2,11

04.01.2016,2,11

];

NoConcatenate

Final:

LOAD TimeStamp1,

     Max(F2) AS F2,

     Max(F1) AS F1

Resident Table1

Group By TimeStamp1;

Drop Table Table1;

Capture.PNG