Joining tables in Data manager
Join is an operation that can be used to manually combine two tables' data, producing varied results depending on the configuration you select.
This allows more granular control over combined tables than with concatenation. See Concatenating tables in Data manager to learn more about concatenation.
The Join operation takes two tables and combines them into one, which will be a combination of the fields in both original tables, based on the overlap of a common value for one or several common fields. There are multiple operators that can be applied to Join operations: Outer, Inner, Left, and Right.
Join operators
There are four join operators: Outer join, Inner join, Left join, and Right join. The selected operator determines which overlapping fields or values are included or excluded.
Outer join
The Outer join operator contains all possible combinations of values from the two tables, if the overlapping field values are represented in either one or both tables. For a more detailed explanation and examples, see the scripting reference entry: Outer.
Example:
A |
B |
---|---|
1 |
aa |
2 |
cc |
3 |
ee |
A |
C |
---|---|
1 |
xx |
4 |
yy |
A |
B |
C |
---|---|---|
1 |
aa |
xx |
2 |
cc |
- |
3 |
ee |
- |
4 |
- |
yy |
Inner join
The Inner join operator only contains combinations of values from the two tables, if the overlapping field values are represented in both tables. For a more detailed explanation and examples, see the scripting reference entry: Inner.
Example:
A |
B |
---|---|
1 |
aa |
2 |
cc |
3 |
ee |
A |
C |
---|---|
1 |
xx |
4 |
yy |
A |
B |
C |
---|---|---|
1 |
aa |
xx |
Left join
The Left join operator contains combinations of values from the two tables, if the overlapping field values are represented in the first table. For a more detailed explanation and examples, see the scripting reference entry: Left.
Example:
A |
B |
---|---|
1 |
aa |
2 |
cc |
3 |
ee |
A |
C |
---|---|
1 |
xx |
4 |
yy |
A |
B |
C |
---|---|---|
1 |
aa |
xx |
2 |
cc |
- |
3 |
ee |
- |
Right join
The Right join operator contains combinations of values from the two tables, if the overlapping field values are represented in the second table. For a more detailed explanation and examples, see the scripting reference entry: Right.
Example:
A |
B |
---|---|
1 |
aa |
2 |
cc |
3 |
ee |
A |
C |
---|---|
1 |
xx |
4 |
yy |
A |
B |
C |
---|---|---|
1 |
aa |
xx |
4 |
- |
yy |
Joining tables
The Concatenate or join pane is accessed by clicking in Data manager, clicking Concatenate or join, and selecting two tables. When tables are selected in Concatenate or join tables, Qlik Sense analyzes the fields and automatically maps any fields together that match. If there are no clear matches, fields are left unmapped. When the join is applied, mapped fields are combined in the joined table. Unmapped fields are either included as individual fields with null values for the rows where there is no corresponding value, or excluded entirely if there are no overlapping instances of the value.
The first table selected in Concatenate or join tables is set as the primary table, the table to which the other table is joined. The joined table uses the table and field names from the primary table unless these are manually renamed. You can change which table is the primary table with the button. Concatenate or join tables arranges fields in two rows, with the primary table fields in the top row and the secondary table fields on the bottom row. You can swap the primary and secondary tables with the button.
You can use Edit mappings to change the default mapping and select which fields to map, leave unmapped, or to exclude from the joined table. Edit mappings contains a drag and drop interface for editing mappings and the Fields pane, which lists all table fields. Fields can be mapped by dragging them beneath a primary table field. Fields can be added as a new unmapped field by beside the field in the Fields pane or dragging them into the top row of fields. Unmapped fields are marked with in the Fields pane. Fields removed from the joined table are not included in the table and are not available for use in Qlik Sense after joins are applied to the table.
Once mappings are applied and the tables are joined, you cannot edit the mapped fields, but they can be removed from the tables by splitting the joined table, which restores the tables to their original state.
To join tables in Data manager, do the following:
- Select tables for joining.
- Optionally, rename the joined table and the field names.
- Optionally, edit mappings.
- Select the join operator.
- Join the tables.
Selecting tables for joining
Do the following:
- In Data manager, click in the bottom row.
-
Click Concatenate or join.
The Concatenate or join pane opens.
-
Select two tables.
The fields of both tables will be mapped or left unmapped in the Concatenate or join tables pane.
- To preview a sample of unique values in each field, click .
- To switch the primary and secondary tables, click .
Renaming the table and field names
Do the following:
- In the Concatenate or join pane, in the table name field, enter a new table name.
- In a field name field, enter a new field name.
Editing mappings
Do the following:
- In the Concatenate or join pane, click Edit mappings.
- To map two fields, click and drag a table field under a primary table field.
- To add a new unmapped field, click and drag a table field into the upper row of fields.
- To remove a field from the joined table, in the field click .
- To return a removed field back to the table, click in the Fields pane, click beside the field.
- Click Edit mappings to close Edit mappings.
Selecting the join operator
Do the following:
- In the Concatenate or join pane, click Select action.
- Select an operator from the list: Outer join, Inner join, Left join, or Right join.
Joining tables
Do the following:
- In the Concatenate or join pane, click Apply.
The tables are now joined.
Splitting joined tables
In cases where joining is no longer needed, you can split the joined tables into their source tables.
Splitting a joined table will remove any associations the joined table had as well as any associations the primary and secondary tables had with each other. If you want to preserve your associations while splitting joined tables, click to undo the join instead of splitting the table. You cannot use to undo joins after you load data in Data manager.
Splitting a joined table
Do the following:
- Select the joined table.
-
Click .
The table is now split into its source tables. All fields in the source tables and their fields have their pre-join names. Splitting a joined table only splits one level of joining, so that any joined tables that were part of the split joined table have their own join preserved.