# Example Job implementing the different match models

## Source data

The main source reads like:

* ID: Name
* 1: Shong
* 2: Elisa
* 3: Sabrina

The Lookup source reads as follows:

* ID: Email
* 1: Shong1@talend.com
* 1: Shong2@talend.com
* 2: Elisa@talend.com
* 3: Sabrina@talend.com

To perform an inner join between the main source and the lookup source, and to produce the data structure based on the two sources:

| ID | Name | Email |
| --- | --- | --- |

The result varies depending on the match model to be used.

## Creating the Job

Use a tFixedFlowInput component to generate the main source.

![Basic settings view for tFixedFlowInput.](https://help.qlik.com/talend/en-US/components/8.0/Resources/images/190513286_main_source.png)

Use a second tFixedFlowInput component to generate the lookup source.

![Basic settings view for tFixedFlowInput.](https://help.qlik.com/talend/en-US/components/8.0/Resources/images/190513286_lookup_source.png)

Use tMap to perform the inner join, and output the result to a tLogRow component (with Table mode) that prints the result on the console.

![tMap component.](https://help.qlik.com/talend/en-US/components/8.0/Resources/images/190513286_example_job.png) ![tMap editor.](https://help.qlik.com/talend/en-US/components/8.0/Resources/images/190513286_tMap_setting.png)

## Using the match models to generate different results

Unique match: This is the default option for the JOIN operation. It outputs the last matching record of the lookup source.

![Unique match default option.](https://help.qlik.com/talend/en-US/components/8.0/Resources/images/190513286_Unique_match.png)

The result of the JOIN by the **Unique match** model reads as follows:

```
Starting Job tMap_Match_modes at 17:46 25/09/2013.

[statistics] connecting to socket on port 3367
[statistics] connected
.--+-------+-------------------.
|          tLogRow_2           |
|=-+-------+------------------=|
|ID|Name   |Email              |
|=-+-------+------------------=|
|1 |Shong  |Shong2@talend.com  |
|2 |Elisa  |Elisa@talend.com   |
|3 |Sabrina|Sabrina1@talend.com|
'--+-------+-------------------'
[statistics] disconnected
Job tMap_Match_modes ended at 17:46 25/09/2013. [exit code=0]
```

First match: It outputs the first matching record of the lookup source.

![First match option.](https://help.qlik.com/talend/en-US/components/8.0/Resources/images/190513286_first_match.png)

The result of the JOIN by the **First match** model reads as follows:

```
Starting Job tMap_Match_modes at 17:51 25/09/2013.

[statistics] connecting to socket on port 3942
[statistics] connected
.--+-------+-------------------.
|          tLogRow_2           |
|=-+-------+------------------=|
|ID|Name   |Email              |
|=-+-------+------------------=|
|1 |Shong  |Shong1@talend.com  |
|2 |Elisa  |Elisa@talend.com   |
|3 |Sabrina|Sabrina1@talend.com|
'--+-------+-------------------'
[statistics] disconnected
Job tMap_Match_modes ended at 17:51 25/09/2013. [exit code=0]
```

All match: It outputs all matching records of the lookup source.

![All match option.](https://help.qlik.com/talend/en-US/components/8.0/Resources/images/190513286_all_match.png)

The result of the JOIN by the **All match** model reads as follows:

```
Starting Job tMap_Match_modes at 17:58 25/09/2013.

[statistics] connecting to socket on port 3381
[statistics] connected
.--+-------+-------------------.
|          tLogRow_2           |
|=-+-------+------------------=|
|ID|Name   |Email              |
|=-+-------+------------------=|
|1 |Shong  |Shong1@talend.com  |
|1 |Shong  |Shong2@talend.com  |
|2 |Elisa  |Elisa@talend.com   |
|3 |Sabrina|Sabrina1@talend.com|
'--+-------+-------------------'
[statistics] disconnected
Job tMap_Match_modes ended at 17:58 25/09/2013. [exit code=0]
```