1 Reply Latest reply: Jul 20, 2011 4:44 AM by Talha Khan RSS

    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

        • Join with if function in script

          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;