# Join Transformation

The *Join* transformation object joins records from two record sets. The join functionality is similar to standard SQL joins, but the distinguishing advantage of Astera's implementation is that you can join records from any two sources and not just two database tables.

This article covers how you can use *Join* transformation in Astera.

### Video

{% embed url="<https://www.youtube.com/watch?v=2J8s9h5JLjs>" %}

### Use Case

Suppose we have two database tables - *Customers* and *Orders*, as shown in the screenshot below, and we want to join these two tables.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2Fq6Lcnjil2zE5VJuqHLqU%2F1.png?alt=media\&token=41a743bd-e63a-4945-9849-bfd67ad23826)

Let’s see how we can join the two tables using the *Join* transformation object in Astera:

1. Drag-and-drop the *Join* transformation object from the *Transformations* section in the Toolbox. To open the Toolbox, go to *View > Toolbox*.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F4ZLCztW3IQxCj0i8spxH%2F2.png?alt=media\&token=d9a20301-c81c-4042-afd8-d5f9ce64bf01)

2. Map the fields from the source objects to the *Join* transformation object.

{% hint style="info" %}
**Note:** To quickly add fields to the layout, drag-and-drop the bold node’s output port of the object whose layout you wish to replicate to the bold *Join* node of the Join object.
{% endhint %}

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FpzTFCiG5A77N4VjUyVqq%2F3.png?alt=media\&token=50167353-0cba-48c8-9252-78362f9788dd)

3. To set the properties for the *Join* transformation, double-click on the object or right-click and select *Properties*.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FzLwjv1774HxB8eBCD0dd%2F4.png?alt=media\&token=360c6285-e11b-427b-a13a-5f1940197ad7)

4. The first window is the *Layout Builder* window. You can manage the layout for your transformation (add or remove fields) from this window. Click *Next* to go to the next window.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2Frngj9YWwxus7hCuk7c56%2F5.png?alt=media\&token=f9c3ff25-d7ea-414a-abc1-fa992235e129)

5. The next window is the *Relation Join Transformation Properties* window. Select the *Join Type* from the drop-down menu. Astera supports four types of joins:

* *Inner Join* – Joins records from two record sets based on matching values in key fields. Any unmatched records are discarded.
* *Left Outer Join* – Similar to *Inner Join*, but unmatched records from the left record set (also called ‘first record set’) are preserved, and null values are written for the unmatched record in the right record set (also called ‘second record set’).
* *Right Outer Join* – Similar to *Inner Join*, but unmatched records from the right record set (also called ‘second record set’) are preserved, and null values are written for the unmatched record in the left record set (also called ‘first record set’).
* *Full Outer Join* - similar to *Inner Join*, but unmatched records from either record set are preserved, and null values are written for the unmatched record in the other record set.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FcMtUpkPbRI4zcATpLUm1%2F6.png?alt=media\&token=f8e0f7c6-87de-4136-918c-9959d4473116)

6. Other options in this window:

* *Join in Database*: Check this option if you want to join the tables in the database.
* *Case Sensitivity*: Check this option if you want a case sensitive match of the values in the key fields.
* *Sort (Left/Right) Input*: Specify whether the left input, the right input, or both, need to be sorted.

7. Select the key fields from the *Left Field* and *Right Field* drop-down lists. Click *Next*, then \**OK*.

{% hint style="info" %}
**Note:** You can add multiple fields to create a composite key field.
{% endhint %}

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FwfRsoSBQNmQBKWXk6wUk%2F7.png?alt=media\&token=e7efccc9-0972-4153-b5ac-e0f3c6a7a9bd)

8. You can now preview the output and see the consolidated data.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FdipcTJUrrkSdti32woO7%2F8.png?alt=media\&token=958a0528-df69-43c8-8b54-cb54916935ee)

#### *General Options* window in *Join* Transformation:

This window consists of options common to most objects in a dataflow.

* *Clear Incoming Record Messages:* When this option is checked, any messages coming in from objects preceding the current object will be cleared. This is useful when you need to capture record messages in the log generated by the current object and filter out any record messages generated earlier in the dataflow.
* *Do Not Process Records with Errors:* When this option is checked, records with errors will not be outputted by the object. When this option is unchecked, records with errors will be outputted by the object, and a record message will be attached to the record. This record message can then feed into downstream objects in the dataflow, for example a destination file that will capture record messages, or a log that will capture messages, as well as collect statistics.
* The *Comments* input allows you to enter comments associated with this object.
