Merging two tables

Five Stars

Merging two tables

suppose I have excel file like table1 as

name    branch         age          email

aaa       computer        20         a@gmail.com

bbb       civil                 27         b@gmail.com

ccc        IT                   32          c@gmail.com

 

and another excel file table2 as

name      age

ppp           26

qqq           28

 

now i want to join this but here is no any common data

output should be like

 

name    branch         age          email

aaa       computer        20         a@gmail.com

bbb       civil                 27         b@gmail.com

ccc        IT                   32         c@gmail.com

ppp       null                 26         null

qqq       null                 28         null

Forteen Stars

Re: Merging two tables

@Pankaj18,since you need to do the full outer join.

check the below link.

https://community.talend.com/t5/Architecture-Best-Practices-and/How-to-do-a-full-outer-join-in-a-Tal...

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Six Stars

Re: Merging two tables

You should perform a FULLJOIN between the files , A leftjoin B union B leftjoin A .

Forteen Stars

Re: Merging two tables

@Pankaj18,still do you have issue?

Manohar B
Don't forget to give kudos/accept the solution when a replay is helpful.
Sixteen Stars TRF
Sixteen Stars

Re: Merging two tables

Use a single tMap to adjust 2nd schema on 1rst one, then use a tUnite to concatenate both flows:

Capture.PNG

Here tFileInputExcel is replaced by tFixedFlowInput for the example.

And the result is:

.----+--------+---+-----------.
|         tLogRow_57          |
|=---+--------+---+----------=|
|name|branch  |age|email      |
|=---+--------+---+----------=|
|aaa |computer|20 |a@gmail.com|
|bbb |civil   |27 |b@gmail.com|
|ccc |IT      |32 |c@gmail.com|
|ppp |null    |26 |null       |
|qqq |null    |28 |null       |
'----+--------+---+-----------'

TRF
Six Stars

Re: Merging two tables

TRF ,

 

But its not correct to unite two different schemas right ?

 

Thanks .

Community Manager

Re: Merging two tables


@praveenvm wrote:

TRF ,

 

But its not correct to unite two different schemas right ?

 

Thanks .


You can quite easily make the schemas the same before you connect to the tUnite. 

Sixteen Stars TRF
Sixteen Stars

Re: Merging two tables

@praveenvm, that's the reason why I started my answer with "Use a single tMap to adjust 2nd schema on 1rst one".


TRF
Six Stars

Re: Merging two tables

@TRF , Ya agreed . But if we are just using the fileExcel instead of your fixedflowinput then it is adjusting the file (adding the missing columns in the file itself) and not adjusting the schema alone right ? Because even if we adjust the schema alone , that would still result in column data mismatch as talend matches file columns and schema columns by matching the order of columns and not my column names. 

 

Thanks.

Sixteen Stars TRF
Sixteen Stars

Re: Merging two tables

@praveenvm, all input schemas must be identicals to use tUnite which is required for the usecase.


TRF
Community Manager

Re: Merging two tables

@praveenvm you are forgetting about the tMap functionality. Put a tMap after the source data and before the tUnite. Schema alignment is not really that complex in this scenario

Sixteen Stars TRF
Sixteen Stars

Re: Merging two tables

@Pankaj18, did this help?

If so, thank's to mark your case as solved (Kudos also acceptedas a bonus).


TRF

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

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