Hi Experts,
Please let me know the general scenarios where we use left join and right join in qlikvew script, while building the data model.
Also, Please point me to some resources.
Regards,
Suraj
Hi Suraj,
Joins purely depends on the requirement, there is no restriction/best one to use.
Inner join - If we want to load only the matching records in both the tables then use Inner Join.
Left join - If we want to load all records in first table and matching records in second table, the unmatched records in second table will be null, in this scenario Left Join is used.
Right join - If we want to load all records in second table and matching records in first table, the unmatched records in first table will be null, in this scenario Right Join is used..
Type of join is purely based on the requirement.
Hope this helps you.
Regards,
Jagan.
Hi,
left join: load all records from first table and only matched record from Second table.
right join : load all records from Second table and only matched record from First table.
Inner Join : Load only matched records from both the table.
Regards,
Ashutosh
Hi Suraj,
Please find explanation below from Qlikview Help file.
LEFT Join
--------------
left( join | keep) [ (tablename ) ](loadstatement |selectstatement )
Examples:
Table1 | |
A | B |
1 | aa |
2 | cc |
3 | ee |
Table2 | |
A | C |
1 | xx |
4 | yy |
QVTable:
select * from table1;
left join select * from table2;
QVTable | ||
A | B | C |
1 | aa | xx |
2 | cc | |
3 | ee |
RIGHT Join:
-----------------
right(join | keep)[(tablename )](loadstatement |selectstatement )
Examples:
Table1 | |
A | B |
1 | aa |
2 | cc |
3 | ee |
Table2 | |
A | C |
1 | xx |
4 | yy |
QVTable:
select * from table1;
right join select * from table2;
QVTable | ||
A | B | C |
1 | aa | xx |
4 | - | yy |
Hope this helps you.
Regards,
Jagan.
Thanks for all the inputs!!
I am actually looking for a sample requirement where we require to use left or right join to build the qlikview data model.
Regards,
Suraj
Hi Suraj,
Joins purely depends on the requirement, there is no restriction/best one to use.
Inner join - If we want to load only the matching records in both the tables then use Inner Join.
Left join - If we want to load all records in first table and matching records in second table, the unmatched records in second table will be null, in this scenario Left Join is used.
Right join - If we want to load all records in second table and matching records in first table, the unmatched records in first table will be null, in this scenario Right Join is used..
Type of join is purely based on the requirement.
Hope this helps you.
Regards,
Jagan.