4 Replies Latest reply: Apr 19, 2017 1:38 PM by Gysbert Wassenaar RSS

    Selecting a list of values from a QVD and using in SQL

    Alex Gorski

      I'm looking to select a list of from a QVD and use the list of values in a SQL IN Clause.

       

      For example if my data was the following:

      LOAD * inline [

      "ID|"First name"|"Last name"|Initials|"Has cellphone"

      1|John|Anderson|JA|Yes

      2|Sue|Brown|SB|Yes

      3|Mark|Carr|MC |No

      4|Peter|Devonshire|PD|No

      5|Jane|Elliot|JE|Yes

      6|Peter|Franc|PF|Yes ] (delimiter is '|');

       

      I would want a variable that would look like ID_LIST(1,2,3,4,5,6)

       

      Then I would take that variable and use it in my SQL:

      SELECT * FROM PEOPLE WHERE ID in($ID_LIST);

       

      I've been trying to use getfieldselections to get the data from my ID and getting an unknown statement error.

       

      Any thoughts?