0 Replies Latest reply: Jul 25, 2012 3:30 AM by THe_evaco RSS

    JOIN: 'Same' code, different results?

      Hello all,

       

      I was recently struggling with a piece of code joining customer data to sales data.

      I finally managed to get it work, but I still wonder about it.

       

      Below you see two versions of what I consider to be the same code.

      V1 is working as expected, V2 not.

      (Simplified you can imagine Sales having three columns: TransactionID, Revenue, CustomerID)

      V2 'ignored' the 'distinct', thus the number of transactions got multiplied.

       

      My question: What is the (internal) difference?

       

      // - V1 -----------------------------------------------
      C:
      LOAD Distinct
             CustomerID,
             CustomerName
      Resident Customers;


      left join(Sales)
      load * Resident C;
      drop table C;


      // - V2 -----------------------------------------------
      left join (Sales)
      LOAD Distinct
             CustomerID,
             CustomerName
      Resident Customers;

       

       

      Thanks for any ideas,

      Thilo