Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Write Table now available in Qlik Cloud Analytics: Read Blog
cancel
Showing results for 
Search instead for 
Did you mean: 
pala_jaga
Partner - Contributor
Partner - Contributor

common rows from two tables

HI I have two table

table1:

S1 Date
11 12/01/2022
22 13/01/2022
33 14/01/2022
44 15/01/2022
55 16/01/2022

table2:

P1 P2 P3
11 one jj;gg;kk
22 one ll;mm;nn
33 one

oo;pp;hh

 

I want ouput like below

p1 p2 p3 date
11 one jj;gg;kk 12/01/2022
22 one ll;mm;nn 13/01/2022
33 one oo;pp;hh 14/01/2022
Labels (3)
2 Solutions

Accepted Solutions
rubenmarin

Hi, that's a join between the two tables:

FinalTable:
LOAD P1, P2, P3
From ...  Table2Source

Left Join (FinalTable)
LOAD S1 as P1, Date
From ...  Table1Source

 

View solution in original post

Lakshminarayanan_J

@pala_jaga 

Rename the Table1  field S1 to P1 using alias name 

and inner join the table with Table2 

Script:

T1:
Load * inline [
P1, Date
11, 12/01/2022
22, 13/01/2022
33, 14/01/2022
44, 15/01/2022
55, 16/01/2022
];
Inner Join(T1)
Load * inline [
P1, P2, P3
11, one, jj;gg;kk
22, one, ll;mm;nn
33, one, oo;pp;hh
];

Result:

Lakshminarayanan_J_0-1660203616093.png

 

Lakshminarayanan J
To help users find verified answers, please don't forget to use the "Accept as Solution" button

View solution in original post

6 Replies
rubenmarin

Hi, that's a join between the two tables:

FinalTable:
LOAD P1, P2, P3
From ...  Table2Source

Left Join (FinalTable)
LOAD S1 as P1, Date
From ...  Table1Source

 

Lakshminarayanan_J

@pala_jaga 

Rename the Table1  field S1 to P1 using alias name 

and inner join the table with Table2 

Script:

T1:
Load * inline [
P1, Date
11, 12/01/2022
22, 13/01/2022
33, 14/01/2022
44, 15/01/2022
55, 16/01/2022
];
Inner Join(T1)
Load * inline [
P1, P2, P3
11, one, jj;gg;kk
22, one, ll;mm;nn
33, one, oo;pp;hh
];

Result:

Lakshminarayanan_J_0-1660203616093.png

 

Lakshminarayanan J
To help users find verified answers, please don't forget to use the "Accept as Solution" button
pala_jaga
Partner - Contributor
Partner - Contributor
Author

Hi @Lakshminarayanan_J 

But I want to load T1 and T2 as separate tables 

after that i want output like above

pala_jaga
Partner - Contributor
Partner - Contributor
Author

Hi @rubenmarin 

But I want to load T1 and T2 as separate tables 

after that i want output like above

rubenmarin

Hi, for that you don't need to do anything in script, just create a table in design with the needed fields as dimensions, change the labels to show as you want and in the dimension P1 uncheck the option to show null values.

Lakshminarayanan_J

@pala_jaga 

You can do it in 2 way if you want separately :

1.as @ Pala_Jaga mentioned you need to rename the Table 1 field S1 to P1 and load the data

2. You can use inner Keep function instead of inner join , I wont join the table you can view table 2 as separate table in datamodel

Script for Inner Keep:

T1:
Load * inline [
P1, Date
11, 12/01/2022
22, 13/01/2022
33, 14/01/2022
44, 15/01/2022
55, 16/01/2022
];
Inner Keep (T1)

Load * inline [
P1, P2, P3
11, one, jj;gg;kk
22, one, ll;mm;nn
33, one, oo;pp;hh
];

for option one comment or remove the Inner Keep script and load the data

Data model:

Lakshminarayanan_J_1-1660208215521.png

UI:

Lakshminarayanan_J_0-1660208198558.png

 

Lakshminarayanan J
To help users find verified answers, please don't forget to use the "Accept as Solution" button