Join or Merge

These are used to link data with another View based on a shared Column.

join graphic

Fig. 133 Example of a Join

Mammoth provides another function, Lookup to achieve similar results. This task is an advanced version of the Lookup.

This is similar to a JOIN operation in an SQL database or a VLOOKUP in Microsoft Excel.

Quick Start

Let us start with the following two views.

  1. Customers → View 1:

ID

Name

1

John

2

Katie

3

Priya

4

Raj

  1. Orders - View 1

ID

Customer ID

Subtotal

Tax

Total

1

2

151

15

167

2

1

89

9

98

3

4

89

9

98

The customer names are associated with the orders. Note that the customer ID column has corresponding values in Customer → view 1.

Orders - View 1 do the following:

  1. Open Data Preparation menu and click on Merge & Branch Out.

  2. Select Join;

  3. Select Customers → View 1;

  4. In select common keys section map Customer ID column to ID column;

  5. Select the type of Join;

  6. Select coulmns in the prefix selection box to add a prefix to the column names of Customers View;

  7. Click APPLY.

This is the final result:

ID

Customer ID

Subtotal

Tax

Total

Customer.Name

1

2

151

15

167

Katie

2

1

89

9

98

John

3

4

89

9

98

Raj

Supported Options

The following options are supported in this task:

  • View to Join with: Allows selecting a view with which to join;

  • Common keys: Allows mapping between pairs of columns with common values;

  • Join Type: Allows one of four join types: Left, Right, Inner or Outer;

  • Mammoth does not allow certain type of joins. For more information, see Restrictions .

Join Types

Left Join

This option selects all the rows from the current View along with the matching rows from the current view.

Left join graphic

Fig. 134 Left Join

Right Join

This option selects all the rows from the other View along with the matching rows from the current View based on the join key.

Right join graphic

Fig. 135 Right Join

Inner Join

This option selects only matching rows from the current View and the other View where the Join condition is met (if at all).

Inner join graphic

Fig. 136 Inner Join

Outer Join

This option selects all the rows from the current View and the other View, regardless of whether the join condition is met.

Outer join graphic

Fig. 137 Outer Join

Restrictions

Mammoth does not allow Join rules of cyclic manner, i.e. If View-1 has a Join rule with View-2, then View-2 cannot have a Join rule with View-1. (See Fig. 138). It creates a chain of data updates between the Views.

cyclic join with 2 views

Fig. 138 If view-1 has a join with view-2 then view-2 cannot join with view-1.

The cyclic behaviour can also occur when more than two Views are involved. (See Fig. 139)

cyclic join with 3 views

Fig. 139 If view-1 has join with view-3 and view-3 has a join with view-2 then view-2 cannot join with view-1.