Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

delete records with subquery

I have two tables in two databases (MYSQL & SQL*Server)

I would like to implement, with talend, the following query:

delete from T1 where T1.key in (select t2.key from T2 where T1.key=T2.key and T1.date<T2.date)

is it possible ?

If yes how?

Thanks

Didier

Labels (2)
1 Reply
Anonymous
Not applicable
Author

Using a tMap to a join between T1 and T2 to get the t2.key, if there exist multiple keys, denomalize all the keys to one line after tMap, write the delete query in a tXXXRow component. eg:
tMysqlInput--main--tMap--main--tDenormalize--main(row2)--tFlowToIterate--iterate--tMssqlRow
                               |
                          lookup 
                              |
                      tMssqlInput

on tMssqlRow, you can write the query as below:
"delete from T1 where T1.key in  "+(String)globalMap.get("row2.columnName")