Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ester_pr
Partner - Creator
Partner - Creator

Join with if function in script

Hi,

I am trying to create a new field from 3 tables

my script is

Snif:load

Distinct  OvedTokefDeptKey,

SnifDept as SacarDept
,
OVEDSACAR as OVEDid

Resident SACAR;

left join LOAD Distinct [dip] as SacarDept,
    
[sub dip] as snif1
    
Resident Division; left join(Snif)

LOAD MIFAL as snif2
,
OVEDOVED  AS OVEDid

Resident Oved;


LOAD OvedTokefDeptKey,

OVEDid,IF(snif1<>0,snif1,snif2) AS SNIF

Resident Snif;

DROP Table Snif;

is there any oter way?

thanks,

Ester

1 Reply
Not applicable

The Below code should work.

Snif:

Load *,
IF(snif1<>0,snif1,snif2) AS SNIF
;

load Distinct
OvedTokefDeptKey,
SnifDept as SacarDept
,OVEDSACAR as OVEDid

Resident SACAR;

left join LOAD Distinct [dip] as SacarDept,
     [sub dip] as snif1
     Resident Division; left join(Snif)

LOAD MIFAL as snif2
,OVEDOVED  AS OVEDid

Resident Oved;