Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all
In my script I am loading a table 'tblSubList' but I am not interested in every record in this table, and loading every record adds time to the script.
Earlier in the script I have another table 'tblCHI' that contains the ID numbers for the records I am interested in.
Can I take the minimum ID from 'tblCHI' and use this in the WHERE clause for 'tblSubList'? Or would a Left Join be just as efficient (as there may not be matching records in 'tblSubList').
In SQL Server I would do something like
@MinSysID = SELECT Min(SYS_ID) FROM tblCHI
SELECT * FROM tblSubList WHERE SYS_ID >= @MinSysID
Can a similar thing be done in QlikView?
Tmp:
SQL SELECT Min(SYS_ID) as min FROM tblCHI;
Let vMin=peek('min');
drop table Tmp;
SQL SELECT * FROM tblSubList WHERE SYS_ID >= $(vMin)
Yes, use the keyword EXISTS, in this way you can load only existing IDs previously loaded
Hope it helps
For tblSubList, you should be able to use a WHERE clause like:
WHERE exists(IDFromtblCHI, IDFromtblSubList)
Hello James,
The Qlikview equivalent way to approach this is by using the PEEK function.
E.g. peek(fieldname [ , row [ , tablename ] ] )
As in SQL you can put the result in a variable and the use that variable in the where clause of the tblSubList table.