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

Combining Tables

Hey,

I have a problem with combining two tables which I have as QVD-Files.

For better understanding I create these two tables:

Table1:

LOAD * INLINE [

    Auftr,      KdNr

    1,           aa,

    2,           cc,

    3,           ee,

];

Table2:

LOAD * INLINE [

    Auftr,      LSNr,      Date

    1,           xx,           10,

    1,           zz,           12,

    3,           yy,           11,

];

What I want to have is a new table with the following content:

AuftrNr,KdNr,LsNr,Date
1,aa,--,--,
1,aa,xx,10,
1,aa,zz,12,
2,cc,--,--,
3,ee,--,--,
3,ee,yy,11,

I tried many different join as well as concatenate approaches but never got the correct result.

Can someone help me?

BR,

Emanuel

1 Solution

Accepted Solutions
sunny_talwar

Can be simplified to this

Table1:

LOAD * INLINE [

    Auftr,      KdNr

    1,          aa,

    2,          cc,

    3,          ee,

];

Join (Table1)

LOAD * INLINE [

    Auftr,      LSNr,      Date

    1,          xx,          10,

    1,          zz,          12,

    3,          yy,          11,

];

Concatenate (Table1)

LOAD DISTINCT Auftr,

  KdNr

Resident Table1;

DROP Table Table2;

View solution in original post

12 Replies
sunny_talwar

May be like this:

Table1:

LOAD * INLINE [

    Auftr,      KdNr

    1,          aa,

    2,          cc,

    3,          ee,

];

Table2:

LOAD * INLINE [

    Auftr,      LSNr,      Date

    1,          xx,          10,

    1,          zz,          12,

    3,          yy,          11,

];

Join (Table1)

LOAD *

Resident Table2;

Concatenate (Table1)

LOAD DISTINCT Auftr,

  KdNr

Resident Table1;

DROP Table Table2;

Capture.PNG

annafuksa1
Creator III
Creator III

Use just join

I have attach example

surendraj
Specialist
Specialist

Hi sunny,

could you please elaborate above solution.its bit confusion for me..

Thanks,

surendra

sunny_talwar

Elaborate what? What part of the script do you not understanding? Its seems like a straight forward script, unless you have specific thing you don't understand

Best,

Sunny

sunny_talwar

Can be simplified to this

Table1:

LOAD * INLINE [

    Auftr,      KdNr

    1,          aa,

    2,          cc,

    3,          ee,

];

Join (Table1)

LOAD * INLINE [

    Auftr,      LSNr,      Date

    1,          xx,          10,

    1,          zz,          12,

    3,          yy,          11,

];

Concatenate (Table1)

LOAD DISTINCT Auftr,

  KdNr

Resident Table1;

DROP Table Table2;

Anonymous
Not applicable
Author

Hey Anna,

your answer is the easiest to understand for me (sorry I'm a newby  )

But I don't understand the meaning of "1 as flag", can you explain it for me.

Edit:

     Unfortunately, the results are not correct..

sunny_talwar

But this doesn't seem like its meeting your requirement, is it?

Capture.PNG

vs. this

Capture.PNG

Or the required output had a typo?

annafuksa1
Creator III
Creator III

its a flag from which table data are coming, you do not need to use it

Anonymous
Not applicable
Author

You are right, I edited my question!