Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
vireshkolagimat
Creator III
Creator III

Associate table based on more than 1 column

Hi Guys,

I have 2 table which contain 2 matching fields and i want create the association on both the fields.

How to achieve this? In general if i want to create association between 2 or more tables based on more than one column what would be the solution.

table1: 

ID

Name

Salary

Date

table2:

ID

Name

City

Designation

Regards,

Viresh

1 Solution

Accepted Solutions
pathiqvd
Creator III
Creator III

Hi,

  Try This,

table1:

ID as ID1

Name as Name1

Salary

autonumber(ID&'-'&Name) as Key

'table1' as Type

Date

table2:

ID as ID2

Name as Name2

City

autonumber(ID&'-'&Name) as Key

Designation

'table2' as Type

take common table:-

Common_temp:

load

ID1 as ID,

Name1 as Name

Type as Common_Type

resident table1;

concatenate

Load

ID2 as ID

Name2 as Name

Type as Common_Type

resident table2;

Common:

LOAD *,

autonumber(ID&'-'&Name) as Key

Resident Common_temp;

drop table Common_temp;

drop field Type;

Regards,

View solution in original post

6 Replies
MK_QSL
MVP
MVP

table1:

ID

Name,

ID & Name as Key,

Salary

Date

table2:

ID & Name as Key

City

Designation

pathiqvd
Creator III
Creator III

Hi,

  Try This,

table1:

ID as ID1

Name as Name1

Salary

autonumber(ID&'-'&Name) as Key

'table1' as Type

Date

table2:

ID as ID2

Name as Name2

City

autonumber(ID&'-'&Name) as Key

Designation

'table2' as Type

take common table:-

Common_temp:

load

ID1 as ID,

Name1 as Name

Type as Common_Type

resident table1;

concatenate

Load

ID2 as ID

Name2 as Name

Type as Common_Type

resident table2;

Common:

LOAD *,

autonumber(ID&'-'&Name) as Key

Resident Common_temp;

drop table Common_temp;

drop field Type;

Regards,

Not applicable

Hi viresh,

In qlikview, if any two (Or more) tables contain same common field names qlikview automatically create the association .

vireshkolagimat
Creator III
Creator III
Author

Yeah but it will generate synthetic key. I want association to happen on two columns without creating synthetic key.

Anonymous
Not applicable

Hi Viresh,

   You can try this

table1:

ID

Name,

Autonumberhash256 (ID , Name as) Key,

Salary

Date

table2:

Autonumberhash256 (ID , Name as) Key,

City

Designation

So,it will use less memory.

-Jai

dsharmaqv
Creator III
Creator III

If you want to go for association then it will create synthetic key.

incase you want to avoide that then you should look for joins.