Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Getting Unique Records after joining 2 or more tables

Hi All,

I have 3 tables as drawn below:

Table 1:

StudentSubjects

Books

A22
B2
C32
D2

Table 2:

StudentSubjects

Books

A2
B32
C32
D2

Table 3:

StudentSubjectsBooks
A22
B32
C

2
D2

Now my requirement is to get a 4th Table as drawn below after merging the above 3 tables.

Table 4:

StudentSubjectsBooks
A22
B32
C32
D2

TIA

Regards,

Rishikesh

4 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Try this.

Data:

Load * from Table1;

Concatenate

Load * from Table2;

Concatenate

Load * from Table3;

Final:

Noconcatenate

Load Distinct * resident Data;

Drop table Data;

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
petter
Partner - Champion III
Partner - Champion III

This should produce the desired result:

T0: LOAD * INLINE [

Student Subjects Books

A 2 2

B 2

C 3 2

D 2

] (delimiter is spaces);

CONCATENATE LOAD * INLINE [

Student Subjects Books

A 2

B 3 2

C 3 2

D 2

] (delimiter is spaces);

CONCATENATE LOAD * INLINE [

Student Subjects Books

A 2 2

B 3 2

C 2

D 2

] (delimiter is spaces);

T:

NOCONCATENATE

LOAD

  Student,

  Max(Subjects) AS Subjects,

  Only(Books) AS Books

RESIDENT

  T0

GROUP BY

  Student;

DROP TABLE T1;



The CONCATENATE prefix is really not necessary as all the fields in the first three loads are identical.

antoniotiman
Master III
Master III

Hi Petter,

may be

...

LastValue(Subjects) as Subjects

...

instead of Max()

Regards,

Antonio

Anonymous
Not applicable
Author

Hi Peter,

In my tables there are around 76 fields but the values differ in only one field.

So should I modify the code provided by you?

Regards,

Rishi