Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
SimonDB
Contributor III
Contributor III

SQL select * FROM sql.db where record EXISTS in QVD

Hi, I'm trying to do a load from a SQL database with a where clause that looks at a QVD. Is this possible?

Something like this

LOAD
     Record,
     Name,
     Address;
SQL SELECT *
FROM $(vDB).customer
WHERE Record IN [D:\MyTable.QVD] (QVD);

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

@SimonDB Or the third option is to construct a variable which can then be passed to your sql

Temp:
LOAD Concat(DISTINCT Chr(39) & Record & Chr(39), ',') as ConcatRecord
From [D:\MyTable.QVD] (QVD);

LET vConcatRecord = Peek('ConcatRecord');

and then you can use this variable in your SQL

LOAD Record,
     Name,
     Address;
SQL SELECT *
FROM $(vDB).customer
WHERE Record IN ($(vConcatRecord));

View solution in original post

3 Replies
MayilVahanan

Hi Simon,

Try like this

Temp:

Load Distinct Record from [D:\MyTable.QVD] (QVD);

LOAD
     Record,
     Name,
     Address where exists(Record);
SQL SELECT *
FROM $(vDB).customer;

or you can use inner join also.

Temp:

Load Distinct Record from [D:\MyTable.QVD] (QVD);

Inner Join

LOAD
     Record,
     Name,
     Address;
SQL SELECT *
FROM $(vDB).customer;

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
sunny_talwar

@SimonDB Or the third option is to construct a variable which can then be passed to your sql

Temp:
LOAD Concat(DISTINCT Chr(39) & Record & Chr(39), ',') as ConcatRecord
From [D:\MyTable.QVD] (QVD);

LET vConcatRecord = Peek('ConcatRecord');

and then you can use this variable in your SQL

LOAD Record,
     Name,
     Address;
SQL SELECT *
FROM $(vDB).customer
WHERE Record IN ($(vConcatRecord));
SimonDB
Contributor III
Contributor III
Author

Thank you both for your replies