Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
chenriot
Contributor III
Contributor III

How to create a table resulting of a cartesian product

Hi everybody,

in a Qlikview script I would like to create a table resulting of a cartesian product.

The first table contains Products :

product_id, product_name

1                  AAAA

2                  BBBB

The second table contains Countries :

country_id, country_name

FR              France

ES              Spain

Il would like a table as :

product_id, product_name, country_id, country_name

1                  AAAA                 FR              France

1                  AAAA                 ES              Spain

2                  BBBB                 FR              France

2                  BBBB                 ES              Spain

I tried using "outer join" but the result is :

product_id, product_name, country_id, country_name

1                  AAAA                 -                 -

2                  BBBB                 -                 -

-                 -                          FR              France

-                  -                         ES              Spain

Can someone help me to have the expected result ?

Thanks in advance

1 Solution

Accepted Solutions
YoussefBelloum
Champion
Champion

Hi,

you should use left join or right join

see attached

View solution in original post

4 Replies
YoussefBelloum
Champion
Champion

Hi,

you should use left join or right join

see attached

Anonymous
Not applicable

try this...

load * inline [
product_id, product_name

1,AAAA

2,BBBB

]
;
join
load * inline [
country_id, country_name

FR,France

ES,Spain
]
;

chenriot
Contributor III
Contributor III
Author

Thanks for your answer. It works.

In fact my problem was with the product table load and not with the join.

chenriot
Contributor III
Contributor III
Author

Thanks for your answer. It works.

In fact my problem was with the product table load and not with the join.