Page 1 of 1

"OR" in a join

Posted: Mon Jul 27, 2009 1:59 pm
by jherr22
Is there a way to incorporate an "OR" condition within a JOIN stage (or lookup)?

Re: "OR" in a join

Posted: Mon Jul 27, 2009 3:42 pm
by ddevdutt
Can you please explain a bit more elaborately as to what your requirement is?

Posted: Mon Jul 27, 2009 5:02 pm
by ray.wurlod
Even so, the answer is no in a Join stage. In a Lookup stage you have the possibility of a range lookup but that's a highly specific case of "OR". As noted, please be more specific.

Posted: Tue Jul 28, 2009 6:53 am
by jherr22
I would like to replicate the following:

select x.a, y.b
from x, y
where x.m = y.m
or x.n = y.n

Posted: Tue Jul 28, 2009 6:57 am
by Sainath.Srinivasan
What is the source ?

What is the data volume ?

Posted: Tue Jul 28, 2009 10:28 am
by ddevdutt
Okay.

One of the ways you can achieve this is to do a lookup first (this will depend on your data volumes)
Then send the rejects from the first lookup to a second lookup stage where you use the same reference dataset.
You can then Funnel the outputs from both the lookup and proceed with any other transformations that you may have.

The first lookup will cater to your first constraint and the second lookup will cater to the second constraint in your "OR" statement.

Let me know if this works.
jherr22 wrote:I would like to replicate the following:

select x.a, y.b
from x, y
where x.m = y.m
or x.n = y.n

Posted: Tue Jul 28, 2009 12:48 pm
by jherr22
ddevdutt:

Perfect - that's the ticket!
I appreciate your help!

Posted: Tue Jul 28, 2009 1:37 pm
by ddevdutt
Glad to be of help :D