Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
In Qlikview Script, is it possible to filter a SQL query based on the result of another query ?
Example :
if i load a Excel file with a column CustomerID (and 5 values), is it possible to use these values in the Where of the next SQL query of the Script ?
Thanks
Yes that's possible. Something like:
ExcelTable:
Load concat(distinct CustomerID, ',') as IDlist
from ...myexcelfile...;
LET vIDlist = peek('IDlist');
SqlTable:
Select * from MyTable
where CustomerID in ($(vIDlist));
If your customer id's are strings you need to change the concat to create single quotes:
concat(distinct chr(39) & CustomerID & chr(39), ',') as IDlist
Yes that's possible. Something like:
ExcelTable:
Load concat(distinct CustomerID, ',') as IDlist
from ...myexcelfile...;
LET vIDlist = peek('IDlist');
SqlTable:
Select * from MyTable
where CustomerID in ($(vIDlist));
If your customer id's are strings you need to change the concat to create single quotes:
concat(distinct chr(39) & CustomerID & chr(39), ',') as IDlist