Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Lesor
Contributor II
Contributor II

Use Qlik Variable in IN clause in SQL

Hi,

Is it possible to use the variable in Qlik in SQL?

In my sample below, the result is that the output still includes Name1 .

 

SET vList = 'Name1' , 'Name2';

LOAD

FirstName, LastName

;

SQL

SELECT 

FirstName, LastName

FROM Table1

WHERE LastName NOT IN '$(vList)'

;

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer

The variable vList contains already the string-wrapping quotes and therefore the call of the variable doesn't have them, means the where should like:

WHERE LastName NOT IN $(vList);

View solution in original post

3 Replies
Gabbar
Specialist
Specialist

Yes it is possible

marcus_sommer

The variable vList contains already the string-wrapping quotes and therefore the call of the variable doesn't have them, means the where should like:

WHERE LastName NOT IN $(vList);

Lesor
Contributor II
Contributor II
Author

Thanks, didn't know I have to removed the single quotes in the SQL.

Mine is now working.