
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
multiple joins between tables
Hi,
I am converting BO report which has below query into Qlikview, there are multiple joins available between two tables , how can I implement same in Qlikview and also column names used in join are not same
Select col1,col2
from table1, table2
where
table1.col1=table2.col2
and table1.col3=table2.col4
and table1.col5=table2.col6

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If it is coming from a database you can load via sql
LOAD *;
SQL SELECT
col1,col2
from table1, table2
where
table1.col1=table2.col2
and table1.col3=table2.col4
and table1.col5=table2.col6
this is a great intro for understanding different joining options: Understanding Join, Keep and Concatenate

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, supossing your query works fine in your database you can just do all the joining in the database end:
TableName:
Load
*
;
SQL
Select col1,col2
from table1, table2
where
table1.col1=table2.col2
and table1.col3=table2.col4
and table1.col5=table2.col6
;


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to Associate the data with the composite key here, as this query is more of an inner join
Table1:
col1,
col3,
col5,
col1&'-'&col3&'-'&col5 as KeyCol
FROM XXXX;
INNER JOIN (Table1)
Table2:
col2,
col4,
col6,
col2&'-'&col4&'-'&col6 as KeyCol
FROM YYYY;
If a post helps to resolve your issue, please accept it as a Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Give the fields that should be used to join the tables the same name in both tables.
Or if you have a working sql statement then use that as-is. Qlikview will send it to the database server to let the database server execute the statement. Qlikview will then get the resulting records back and load those in a table.
talk is cheap, supply exceeds demand


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Vibhu Sharma,
Approach 1: Use sql select, so the you can apply joins using sql query from qlik itslef.
Approach 2: use Vineet Pujari's script.
PFA - Extended version of Approach 2.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
how do implement SQL in script based on multiple tables
I tried to select multiple tables in Create Select Statement window in script editor but it is not allowing me to do so


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
