Friday, 05 May 2021
autanabp
When working with the Qlikview Script we can make use of the Join function. In today’s post we will talk about two specific types of Join: Left Join and Right Join. Let’s see how they work.
To see how it works, we will use two example tables:
Table 1:
| Client Code | Name |
| 1 | Marian |
| 2 | David |
| 3 | Yolanda |
Table 2:
| Client Code | Favorite Color |
| 1 | Blue |
| 4 | Green |
| 3 | Red |
Both Joins will be done using the fields that match in both tables, in the example, Customer Code.
LEFT JOIN:
When we use a Left Join all records in the first table will be kept and only records in table 2 that match table 1 will be kept.
Using the tables in our example, it would look something like this:
| Client Code | Name | Favorite Color |
| 1 | Marian | Blue |
| 2 | David | |
| 3 | Yolanda | Red |
RIGHT JOIN:
When we use a Right Join all records in the second table will be kept and only records in table 1 that match table 2 will be kept.
Using the tables in our example, it would look something like this:
| Client Code | Favorite Color | Name |
| 1 | Blue | Marian |
| 4 | Green | |
| 3 | Red | Yolanda |
