Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Smeenakshi23
Creator II
Creator II

Selecting Multiple tables and left join with only one table

Hello,

I am sorry for this question.. I know this is a basic one. But couldn't implement, as I just started learning development.

I have a SQL select statement in QLikview

Ex:

Select

all the tables


from

table A
table B
table C
Table D

WHERE CONDITION

FILED 1.TABLE A = FILED1.TABLE B

FILED 2.TABLE B = FIELD2.TABLE B

and other linking conditions

GROUP BY FILEDS in all the tables


I need to use left join the table B with Table A.

i am not pretty sure to implement this as it has group by and where clause

Labels (1)
1 Solution

Accepted Solutions
Stoyan_Terziev
Partner - Creator III
Partner - Creator III

Hi Sowmiya,

The result of your demo query would be a single table which has already pre-joined the tables using standard SQL.

Doing that would look like:

Select
A1.DataKey,
A1.Data2,
B1.Data1
FROM
TABLEA A1
LEFT JOIN TABLEB B1
ON A1.DataKey = B1.DataKey

 

If you want to do the join in QlikView:

 

TableA:
LOAD
DataKey,
Data2
;
Select
DataKey,
Data2
FROM
TABLEA
;


LEFT JOIN (TableA)
LOAD
DataKey,
Data1
;
Select
DataKey,
Data1
FROM
TABLEB
;

 

View solution in original post

6 Replies
Stoyan_Terziev
Partner - Creator III
Partner - Creator III

Hi Sowmiya,

The result of your demo query would be a single table which has already pre-joined the tables using standard SQL.

Doing that would look like:

Select
A1.DataKey,
A1.Data2,
B1.Data1
FROM
TABLEA A1
LEFT JOIN TABLEB B1
ON A1.DataKey = B1.DataKey

 

If you want to do the join in QlikView:

 

TableA:
LOAD
DataKey,
Data2
;
Select
DataKey,
Data2
FROM
TABLEA
;


LEFT JOIN (TableA)
LOAD
DataKey,
Data1
;
Select
DataKey,
Data1
FROM
TABLEB
;

 

Smeenakshi23
Creator II
Creator II
Author

Sorry If my question wasnt clear. I need to join within a table.. I believe now the mentioned where condition does  eqi join.. I wanted to change that to inner join.

Smeenakshi23
Creator II
Creator II
Author

Wanted to change that to a left join

Stoyan_Terziev
Partner - Creator III
Partner - Creator III

Hi,

 

Can you export to excel the content of each table (or a data sample) and show me how you would like the end result to look like.

Keep in mind, to change the type of joins, you can practically change the word 'LEFT' in the code I sent you with 'INNER/OUTER/RIGHT' if you need.

Check here some explanation about joins you can find useful: https://www.edureka.co/blog/sql-joins-types

 

Kind regards,

S.T.

Smeenakshi23
Creator II
Creator II
Author

Hello, I tried this and  the qlikview is getting hung.. Actually, my first table called employee inner join with one of the table called sales.. so wen there is no sale data.. all my first emlloyee table fields as excluded.. so even wen there is no value in sale table , my employee table needed to show the values.

 

AS of in the previous script there is where clause instead of inner join.. I need to change that to a left join.

 

 

Also , followed by employee table there are many tables that get inner joined ..

Brett_Bleess
Former Employee
Former Employee

You can also check out the Design Blog area of Community:

https://community.qlik.com/t5/Qlik-Design-Blog/bg-p/qlik-design-blog

There are over 700 posts there from our internal experts and most are how-to related, so should prove useful in trying to get ideas on how to approach things.  

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.