Seven Stars

## How to perform a CROSS JOIN with Talend?

I have two row links from two different tables, and need to combined them in a Cartesian way. Any idea?

Thank you,

Lorenzo

---

The SQL CROSS JOIN produces a result set which is the number of rows in the first table multiplied by the number of rows in the second table.

This kind of result is called as Cartesian Product.

Tags (1)

Accepted Solutions
Sixteen Stars

## Re: How to perform a CROSS JOIN with Talend?

It works as expected:

Got 3 lines in main table ("aaaaa", "bbbbb", "ccccc") and 2 lines in the lookup ("AAAAA", "BBBBB").

The result contains 6 lines:

```Starting job test at 20:01 29/05/2017.

[statistics] connecting to socket on port 4063
[statistics] connected
.-----+-----.
|tLogRow_35 |
|=----+----=|
|aaa  |bbb  |
|=----+----=|
|aaaaa|AAAAA|
|aaaaa|BBBBB|
|bbbb |AAAAA|
|bbbb |BBBBB|
|ccccc|AAAAA|
|ccccc|BBBBB|
'-----+-----'

[statistics] disconnected
Job test ended at 20:01 29/05/2017. [exit code=0]```

Hope this helps.

TRF

All Replies
Sixteen Stars

## Re: How to perform a CROSS JOIN with Talend?

Never tried before, but what if you use a tMap with these 2 tables, 1 one as main and 1 as lookup, then no join in the tMap and an output flow based on fields from these tables?

TRF
Sixteen Stars

## Re: How to perform a CROSS JOIN with Talend?

It works as expected:

Got 3 lines in main table ("aaaaa", "bbbbb", "ccccc") and 2 lines in the lookup ("AAAAA", "BBBBB").

The result contains 6 lines:

```Starting job test at 20:01 29/05/2017.

[statistics] connecting to socket on port 4063
[statistics] connected
.-----+-----.
|tLogRow_35 |
|=----+----=|
|aaa  |bbb  |
|=----+----=|
|aaaaa|AAAAA|
|aaaaa|BBBBB|
|bbbb |AAAAA|
|bbbb |BBBBB|
|ccccc|AAAAA|
|ccccc|BBBBB|
'-----+-----'

[statistics] disconnected
Job test ended at 20:01 29/05/2017. [exit code=0]```

Hope this helps.

TRF
Sixteen Stars

## Re: How to perform a CROSS JOIN with Talend?

@Lorenzo, does this helps you?

TRF
Seven Stars

Yes, thanks.

## OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

## What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

## Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

## Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog

## Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog