Skip to content

Instantly share code, notes, and snippets.

@ralfbecher
Created September 11, 2013 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ralfbecher/6529535 to your computer and use it in GitHub Desktop.
Save ralfbecher/6529535 to your computer and use it in GitHub Desktop.
Create a list of values variable for the usage in a SQL Where IN-Clause.
Companies:
LOAD * INLINE [
Company
CompanyA
CompanyB
CompanyC
];
List:
LOAD
concat(Company,chr(39)&','&chr(39)) as AllCompanies
resident Companies;
LET vList = chr(39)& peek('AllCompanies') & chr(39);
// Sample SQL Select Statement:
SQL SELECT * FROM company WHERE name IN ($(vList));
@marcelo-7
Copy link

Alternative to peek:
LET vList = FieldValue('AllCompanies', 1);

Thanks!

@ralfbecher
Copy link
Author

Well, FieldValue() shouldn't be faster or better in this case of one row..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment