Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

georgian2132
New Contributor II

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

Re: Getting Unique Records after joining 2 or more tables

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

MVP
MVP

Re: Getting Unique Records after joining 2 or more tables

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
Honored Contributor III

Re: Getting Unique Records after joining 2 or more tables

Hi Petter,

may be

...

LastValue(Subjects) as Subjects

...

instead of Max()

Regards,

Antonio

georgian2132
New Contributor II

Re: Getting Unique Records after joining 2 or more tables

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

Community Browser