Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
IMPORTANT security patches for GeoAnalytics Server available to download: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
nehasharma1006
Contributor III
Contributor III

Joins with multiple columns

Hi All,

I have 2 tables named Policy and Client.

I want to make a join between the above 2 tables  based on 2 different columns from Policy and 1 column from Client table like

Client.Client_ID = Policy.First_User_Id and

Client.Client_ID = Policy.RO_Name_Id

But as we all know we can't have join the two tables based on 2 columns so I used this approach -

I created 2 additional column in each table like -

Policy Table -

Autonumber(PO_FIRST_USER_ID,[RO_NAME_ID]) as 'Client ID'

Client Table -

Autonumber(CL_CLIENT_ID,CL_CLIENT_ID) as 'Client ID'

Please suggest if this is the right approach or the above requirement can be implemented in some other way.

1 Solution

Accepted Solutions
Anonymous
Not applicable

your Approach would be okay, if Policy.First_user_id and Policy.RO_Name_id are always identical.

I donot know your Business, but Policys can have different persons (and therefor different ids). Insurance policys might have the insured Person and a Person who pays. If These persons are not identical you will not get a match.

An Approach might be to duplicate the Client table and Name Client id to RO_Name_id (which is for sure not best Approach as it takes additiional space)

View solution in original post

5 Replies
Anonymous
Not applicable

your Approach would be okay, if Policy.First_user_id and Policy.RO_Name_id are always identical.

I donot know your Business, but Policys can have different persons (and therefor different ids). Insurance policys might have the insured Person and a Person who pays. If These persons are not identical you will not get a match.

An Approach might be to duplicate the Client table and Name Client id to RO_Name_id (which is for sure not best Approach as it takes additiional space)

maxgro
MVP
MVP

also

Client.Client_ID & '|' & Client.Client_ID as key

Policy.First_User_Id & '|' & Policy.RO_Name_Id as key



nehasharma1006
Contributor III
Contributor III
Author

Thanks Rudolf for the answer and logic. Your logic seems to be correct we can have different FIRST_USER_ID and RO_NAME_ID and thus creating alias of Client table should be the suitable approach here.

nehasharma1006
Contributor III
Contributor III
Author

would this act same as what I implemented ?

maxgro
MVP
MVP

yes, try, reload and open the table viewer (ctrl+t); you should see the 2 tables associated (join) by the field key