1 Reply Latest reply on Oct 26, 2018 8:22 AM by Rory Wallis

    How to do multiple joins with "condition" clause?

    Ivan Monnier

      Hello,

       

      I am not native english, so my post title may be confusing.

       

      I have built a view in SQL with several join clauses as follows

       

      Select

      srctbl.*

      ,exttbl1.*

      ,exttbl2.*

      ....

      ,exttbl6.*

      from mybigtable as srctbl

       

      LEFT OUTER JOIN

           external_table_1 AS exttbl1

           ON srctbl.DATE = exttbl1.DATE

           AND srctbl.ID= exttbl1.ID

           AND srctbl.record_type = 'TYPE1'

           AND srctbl.domain = 'DOMAIN1'

       

      LEFT OUTER JOIN

           external_table_2 AS exttbl2

           ON srctbl.DATE = exttbl2.DATE

           AND srctbl.ID= exttbl2.ID

           AND srctbl.record_type = 'TYPE2'

           AND srctbl.domain = 'DOMAIN2'

      ....

      LEFT OUTER JOIN

           external_table_6 AS exttbl6

           ON srctbl.DATE = exttbl6.DATE

           AND srctbl.ID= exttbl6.ID

           AND srctbl.record_type = 'TYPE6'

           AND srctbl.domain = 'DOMAIN6'

       

      This works fine.

      I tried to reproduce this with Tableau Prep, but I could not find the way to add the clauses with strings (ie. srctbl.record_type = 'TYPE6' or srctbl.domain = 'DOMAIN6')

       

      Has anybody done this or have any idea?

       

      Thanks in advance

       

      Ivan Monnier