Updating table based on lookup in TALEND - talend

I have a table (table 1), which I need to join (I am using lookup) with another table (table 2) and update table1 based on changes on table2 using join in tMap:
tMysqlInput (table 1) >> lookup with tMysqlInput (table 2) >> tMap >> tMysqlOutput (table1)
Basically updating table1 based on record on changes in table 2 for matching rows.
Please help if any work around.

Related

Insert foreign keys into table A foreach row from table B

I would like to write an INSERT INTO script that takes all the rows from table B (let's assume table B has 300 rows) and uses their ids as foreign key values for some column of table A (the one I want to insert to), so I will end up with 300 new rows inserted into table A.
How can I achieve that in PostgreSQL?
INSERT INTO "table_A" ("id_in_table_B")
SELECT
"id"
FROM "table_B"

(PostgreSQL) Table A tied to multiple entries in Table B, Need to Sum the number in a column of each Table B entry

I'm working on a SQL project and I'm a bit stuck trying to pull a specific piece of data.
Table A contains a_id (primary ID), and a_name, while table B contains b_id (primary ID), b_name, and b_sales. A third table contains a_id, and b_id.
In this example, there are multiple entries in table B for each entry in Table A, I want to sum b_sales for each entry in Table A.
So if a Table A entry is tied to 2 entries in Table B, each with b_sales of 5 for example, I want to show that A Entry has having 10 total b_sales.

PostgreSQL: how to create a trigger that runs after adding a new row in one table and rows related in another table?

I have two tables, e.g. TABLE1, TABLE2. They are joined by "one-to-many" relationship (many records from TABLE2 are referencing to every record in TABLE1). I want to make a trigger that runs just after adding a new row in TABLE1 and all the rows related with it in TABLE2. How to solve it? In particular, how to "inform" the trigger that all related rows from TABLE2 are added?

Unique data best approach

I have two tables,
TABLE A (id, some_data)
TABLE B (id, some_data)
Table A gets filled all the time, about 400 records / sec and there are lots of data that is
the same inside.
I need Table B that shows only unique data in it from Table A for a specific column.
My approach would be to have trigger (on insert) for Table A and check if that data is already present in Table B, if isn't just insert it there.
Can someone point for a better solution?
Thanks.

Linq to entity navigation properties

I need to get the 3rd level entities using navigation properties.
table1
table2
table3
table4
table5
Table 1 relates to table2 and table 2 relates to table 3,4,5 with foreign key relation ships.
I want to pull the data from table 3,4,5 based on the table1 fields. I tried to use the include method but unable to find the method. If you can give the sample code that would be very helpful.
Use the include method in System.Data.Objects. Include should work with the .Include("Table1.PropertyNameTable2.PropertyNameTable3.PropertyNameTable4"); notation.
http://msdn.microsoft.com/en-us/library/bb738708.aspx