#1 2012-03-30 17:51:11

neosz
Guest

join and update

Tags: [database, oracle]

Hello, I'm new to Talend,

I have 2 tables: table1, table2

For each row of table1, I need to know if table1.attribute1 has a corrispondent value in table2.attribute2.

After that I need to update table1.attribute3 with value 'Y'.

Anyone can suggest me how to do it?


Thanks in advance.

#2 2012-03-30 18:38:51

phobucket
Member
Company: Knoetry
Registered: 2010-07-27
Posts: 146
Website

Re: join and update

What database are you using?  You could do this entirely within the db using a t<db>Row component, but the syntax varies slightly based on the database.

MySQL example

"UPDATE table1, table2
SET table1.attribute3 = 'Y'
WHERE table1.attribute1 = table2.attribute2"

Offline

#3 2012-03-30 19:35:13

neosz
Guest

Re: join and update

Oracle 10

#4 2012-03-31 10:29:59

neosz
Guest

Re: join and update

and if the two tables were in different databases?

#5 2012-04-02 09:54:24

janhess
Member
Company: Newcastle University
Registered: 2009-05-19
Posts: 1122

Re: join and update

Use tMap to join the tables. Pass table1 key and attribute to output and set the attribute to "Y". Pass output to tdatabasetypeOutput and set for update.

Offline

#6 2012-04-02 11:32:09

neosz
Guest

Re: join and update

I'll try. Many thanks smile

Board footer

Powered by FluxBB