Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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

Labels (1)
7 Replies
squeakie_pig
Creator II
Creator II

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

Anonymous
Not applicable
Author

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

;

vinieme12
Champion III
Champion III

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;

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

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
rajuamet
Partner - Creator III
Partner - Creator III

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.

Not applicable
Author

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

rajuamet
Partner - Creator III
Partner - Creator III

Hi Vibhu Sharma,

Take a quick look at this link

https://community.qlik.com/thread/133042