Skip to main content

Join or Merge

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

Example of a Join

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

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

Quickstart

Let us start with the following two views.

  1. Customers → View 1:
IDName
1John
2Katie
3Priya
4Raj
  1. Orders - View 1
IDCustomer IDSubtotalTaxTotal
1215115167
2189998
3489998

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. Go to the Combine menu.
  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:

IDCustomer IDSubtotalTaxTotalCustomer.Name
1215115167Katie
2189998John
3489998Raj

It is possible to see which customers never placed an order too. Let us try to do that.

  1. Edit the last task.
  2. In the Join Type section, select Right.
  3. Click APPLY.

The result would look like this:

IDCustomer IDSubtotalTaxTotalName
3Priya

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 .
note

You can also join text columns to numeric columns and vice versa in Mammoth, given the values in the columns match. For example, you can join a numeric column with say a value '25' and a text column with the same value '25', without converting the text column to numeric datatype first. Mammoth casts the values to the appropriate type for the join.

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

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

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

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

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 the following diagram). It creates a chain of data updates between the Views.

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 the following diagram)

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.