Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
andreyfcdk91
New Contributor III

Connect two tables with 2 keys

Good day!

i have one table with fileds:

Sales:

Company

Product_Id

Second table

Product classifier:

Company

Product_Id

Product_name

In result it make syn key.

How to connect these two tables w/o syn key ?

Thx.

1 Solution

Accepted Solutions

Re: Connect two tables with 2 keys

You can try it this way, though there might be other ways. You need to give more details to give you a solution which will suit you the best.

QUALIFY *;

UNQUALIFY Join;

Sales:

LOAD Company,

          Product_Id,

          Company&Product_Id as Join

FROM yourSource1;

[Product Classifier]:

LOAD Company,

          Product_Id,

          Product_name,

          Company&Product_Id as Join

FROM yourSource2;


UNQUALIFY *;


HTH

Best,

Sunny

6 Replies

Re: Connect two tables with 2 keys

You can try it this way, though there might be other ways. You need to give more details to give you a solution which will suit you the best.

QUALIFY *;

UNQUALIFY Join;

Sales:

LOAD Company,

          Product_Id,

          Company&Product_Id as Join

FROM yourSource1;

[Product Classifier]:

LOAD Company,

          Product_Id,

          Product_name,

          Company&Product_Id as Join

FROM yourSource2;


UNQUALIFY *;


HTH

Best,

Sunny

Not applicable

Re: Connect two tables with 2 keys

I think Product_Name is high level data granularity dimension, Just use ApplyMap or Left join the table.

MVP
MVP

Re: Connect two tables with 2 keys

1) there is no need to remove the syn key

2) but if you want to remove 

Sales:

load Company & '-' & Product_Id as Key inline [

Company, Product_Id

a,1

b,2

];

[Product classifier]:

load *, Company & '-' & Product_Id as Key inline [

Company, Product_Id, Product_name

a,1,product a

b,2, product b

c,1, product c

];

3) another remove syn key

Sales:

load AutoNumber(Company & '-' & Product_Id) as Key inline [

Company, Product_Id

a,1

b,2

];

[Product classifier]:

load *, AutoNumber(Company & '-' & Product_Id) as Key inline [

Company, Product_Id, Product_name

a,1,product a

b,2, product b

c,1, product c

];

andreyfcdk91
New Contributor III

Re: Connect two tables with 2 keys

Many thanks)

andreyfcdk91
New Contributor III

Re: Connect two tables with 2 keys

Thanks for advice!

andreyfcdk91
New Contributor III

Re: Connect two tables with 2 keys

Thanks

Community Browser