7 Replies Latest reply: Dec 5, 2017 3:40 PM by Andrew Moberg RSS

    Use data from resident load in SQL query

    Andrew Moberg



      Can someone direct me on how to use a resident load as part of an IN statement in an SQL where clause?

      I have a primary key that is populated in a load statement that I wan to utilize in the where statement of an sql query.

      Here is an example of the script:



      LOAD        ID 

      FROM       excelsheet; //contains 500 ID values


      LET vID = PEEK('ID','IDSTG');



      LOAD          DISTINCT *;


      SELECT     ID, Date, Name

      FROM         Tbl1

      WHERE      ID IN ('$(vID)')


      I want to use vID like it is a temp table that can be referenced in the SQL script.