0

I have data in excel file which I want to insert into database table. One of the column (name) is connected with another table from db. I would like to make a simple query according to value from excel and put into table only id.

Sample of excel file:

age       name     position
-------  -------  -------
23        Kate      PWN
36        John      TDF

Sample of table from db:

id        name     
-------  -------  
1         Kate    
2         John   

Table which I would like to put data from excel:

id       name_id  position
-------  -------  -------
1           1      PWN
2           2      TDF

Basically I need to get data from excel file, iterate and make a simple query

SELECT (id) FROM name WHERE name = name_from_excel; 

Then I can put id into proper field in tMap.

tMap where description and value are name

kek
  • 1
  • 2

1 Answers1

0

You can do this with a simple join in Talend:

                DB Input
                    |
                    |  
tFileInputExcel -- tMap -- DB Output

Inside tMap you join the column Name from your excel with the Name column from your table, and insert the columns you want in your target DB

Ibrahim Mezouar
  • 3,981
  • 1
  • 18
  • 22
  • Could you please check my image which I added? I've got a reply that the *id cannot be resolved or is not a field" – kek Feb 25 '19 at 09:52
  • That's normal, you didn't specify what you want to do with the 2 fields you added; for instance, if you want to concatenate them, you should do: field1 + field2 – Ibrahim Mezouar Feb 25 '19 at 13:15
  • I do not want to concatenate them. I need to make a query according to field1 and get from db field2. How can I do it? – kek Feb 26 '19 at 12:54