Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

use results of query in another query

i should insert a result of query in another query .

my problem is the first query has many results and i should try the results in condition clause where (like)

example: 

the first query results are for example (1,2,3)

the second query is like that 

select code from codes where code like'%1%' and code like'%2% and code like'%3%'

i should have a dynamic query and i don't know which component i will use 

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

thanks for the response 

i have executing the job but there is an error the query is not perfect !

it's like that:

select code_grille_talend from code where code_grille_talend like'%2%'and
select code_grille_talend from code where code_grille_talend like'%1%'and

it can't execute in the TSqliteinput error

that's why it's should be like: 

select code_grille_talend from code where code_grille_talend like'%2% and code_grille_talend like'%1%' 

Idea Please !!

View solution in original post

10 Replies
akumar2301
Specialist II
Specialist II

You could use tJavaFlex to build your Query and then use the Query in TOracleInput

 

0683p000009M2k9.jpg

vapukov
Master II
Master II

answer from @uganesh is correct,

 

just need to add " and "

and logic for handle single row result - avoid " and " at the end

akumar2301
Specialist II
Specialist II

Thanks @vapukov 

 

Correction 0683p000009M2VU.jpg

Anonymous
Not applicable
Author

thanks for solution 

but i don't have results because i need to that query have all conditions where clauses like for example 

if code is like '%1%' and code is like '%2%' and code is like'%3%' 

i need to have results for who has all condition in the query . i should have a dynamic query for this problem .  

this is my job to explicate more the problem 

any ideas for the job !


4.PNG
1.PNG
2.PNG
3.PNG
vapukov
Master II
Master II

answer from @uganesh prepared dynamic where condition

 

what is an additional problem?

Anonymous
Not applicable
Author

thanks for response 

i'm beginner in talend 

how to insert this dynamic query from tjavaflex to tdbinput dynamically!

my job is correct or  no?

if i execute my job i have 0 rows ?

 

vapukov
Master II
Master II

because @uganesh already put text into variable

 

just connect subjob where you prepare final query to the next subjob (where you run it) by OnSubJobOk gtrigger

 

and instead of any SQL code put

(String)globalMap.get("Query")

 

Anonymous
Not applicable
Author

thank you 

i try it but i don't have the results . this are capture of my subjob and final job what's wrong in this job !

thanks

 


output.PNG
subjob.PNG
final job.PNG
vapukov
Master II
Master II

subjob in Talend it is not only a child job (which you run with tRunJob)

 

it is just a group of components connected by dataflows 

 

Child job do not return variables to parent job by default

 

put all in the same Job, just in 2 subjob