4 Replies Latest reply: Jan 11, 2013 12:25 PM by Daniel Taylor RSS

    load same distinct key from 2 tables for where exists

      Hello QV Community,

       

      I am checking to see if this code looks correct, I am not getting the expected results. I want to only load ContactKey where it exists in two tables dependent on various criteria. I also want to perform this more than once, but have the second iteration ignore the already loaded data. Is that possible?

       

      //Iteration1

       

      T1:

      LOAD DISTINCT ContactKey

      FROM fContact.qvd (qvd)

      WHERE RecordDate>=$(vMinDate);

       

      INNER JOIN (T1)

      LOAD DISTINCT ContactKey

      FROM dContact.qvd (qvd)

      WHERE Description='Desc1';

       

      Contact:

      LOAD ContactKey,

                 'Category1' AS Category,

                 ContactName          

      FROM fContact.qvd (qvd)

      WHERE EXISTS (ContactKey);

       

      DROP TABLE T1;

       

      //Iteration2

       

      T3:

      LOAD DISTINCT ContactKey

      FROM fContact.qvd (qvd)

      WHERE RecordDate>=$(vMinDate);

       

      INNER JOIN (T3)

      LOAD DISTINCT ContactKey

      FROM dContact.qvd (qvd)

      WHERE Description='Desc2';

       

      Contact:

      LOAD ContactKey,

                 'Category2' AS Category,

                 ContactName          

      FROM fContact.qvd (qvd)

      WHERE EXISTS (ContactKey);

       

      DROP TABLE T2;