5 Replies Latest reply: Feb 17, 2012 2:19 PM by Eva POLINI RSS

    join on like

    Eva POLINI

      hi,

       

      Do you know how make a join on a like.

       

      ID1= ID2 become ID1 like ID2

       

      When I named both ID tthis the same name I have a join on equal only.

       

      Thanks by advance.

      Eva

        • join on like
          Celambarasan Adhimulam

          Hi,

               Use this approach

               TableName:

               Load

                    ID1..

               From..

               Left join(TableName)

               Load

                    ID2 as ID1..

               From..

           

          Hope it will help you

           

          Celambarasan

          • join on like
            tresesco

            You can only use the join clause to join on the equality of one or many fields. If they're ALL equal, then it's a match, if not, then not. The only operators supported in the join clause are 'and' and 'equals'. If you only use inner join, then you could use a cross join instead to emulate an inner join and filter in the where condition, e.g:

             

            Code Snippet

            From a in db.Table1 _

            From b in db.Table2 _

            Where a.Something=b.Something And a.SomethingElse.StartsWith("a")

             

             

            Regards,  tresesco

            • Re: join on like
              John Duffy

              Hi Eva.

               

              I tried a different approach:

              Create a cartesian product with the two tables.

              Use the length of ID1 to match to ID2 (ie.if (ID1 = left(ID2,length of ID1).

               

              See the attched example.

               

              John.