Page 1 of 1

Lookup Condition

Posted: Wed Apr 08, 2015 3:17 am
by vamsi.4a6
I have two tables table1 and table2.Lookup stage is used between table1 and table2.table1 is master link.In lookup stage we have following properties

Condition is table2.Col2='ABC',condition not met=Continue and Lookup failure=Drop.


I want to convert above logic to sql.Any body help on this.I know how to implement Lookup failure=Drop(Inner join) but not sure how to implement Condition is table2.Col2='ABC',condition not met=Continue in sql query

Posted: Wed Apr 08, 2015 4:35 am
by priyadarshikunal
Although its a straight forward answer, But I would like to know if you have given any thoughts on this, or if it is a Interview Question.

Why not look at the records in the output for those records which doesn't meet the condition criteria.

Posted: Wed Apr 08, 2015 5:39 am
by vamsi.4a6
It was not a Interview question.

Posted: Wed Apr 08, 2015 4:57 pm
by ray.wurlod
Consider the behaviour of the Lookup stage when the Lookup Failed rule is Continue.

With Lookup Failed set to Drop and Condition Not Met set to Continue, the same behaviour will obtain for records in which the condition is not met. However, the condition can not use data from the reference input link, for obvious reasons.

Re: Lookup Condition

Posted: Fri Apr 10, 2015 12:34 am
by syedmuhammedmehdi
I think this is the answer

select *from table1 t1
inner join table t2
on t1.col1=t2.col1

where col1 - lookup column & as condition t2.col2='ABC' is not dropping any record it is not required in query.

Posted: Fri Apr 10, 2015 8:10 am
by AshishDevassy
select
table1.cols,
table2.cols
where
table1.key = table2.key
and
table2.col2 not in ('ABC')