Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.

Multiple conditional statement in JOIN

Lyner
5 - Atom

I'm working on converting a Perl script with bunch of sql queries to an Alteryx workflow.

I was stuck in a part of a join statement with conditional statement.

I've searched numbers of questions here in the community about "Conditional statement with JOIN tool, etc."
Tried and wasn't able to work with it.

 

Here is the part of the sql query.

Like what others said related to this topic. Conditions should put first before the actual Join tool, Either include in the input tool(which is not applicable on this part) or use other tools like filter, formula, etc.

 

I can say that I am getting wrong records by executing the query in a database management tool and comparing the return row counts. 

 

Appreciate your help guys.

 

ter with an alias of try1 is on the right, the rest comes from different tables from the left.

 

 

left outer join ter try1 on try1.country_code = site.COUNTRY_CODE and

( try1.BU = (case when cnt.LEADING_BU_L$ = 'PP' or cnt.LEADING_BU_L$ = 'PR'
   then 'EN'
   else cnt.LEADING_BU_L$ end)

   or

 try1.BU_ZIP = (case when cnt.LEADING_BU_L$ = 'PP' or cnt.LEADING_BU_L$ = 'PR' 
   then 'EN'
   else cnt.LEADING_BU_L$ end) ) and position(nvl(try1.ZIP, try1.BU_ZIP) in site.std_zip_code) = 1

 

 

 

The calgary input is where the left data.

I tried to use union first for me to be able to do the conditions because there are columns needed to compare from left and right table. since I need to do the condition before the join tool.

request4_ss.PNG

 

0 REPLIES 0
Labels
Top Solution Authors