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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikviewforum
Creator II
Creator II

Use of exists in the SQL in statement

I have field called f_Acct which contains around 1000 values before loading the FACT table from a database.

Load *,

where exists(f_Acct,ACCT);

SQL Select Column1,

           Column2,

           ACCT

From Account_Table;

Instead of using the exists in the Qlikview load statement I want make use of the same in the SQL Statement. As the SQL load all the data from the Account_Table and then we filters the values in the Preceding load using exists which having performance issue. Please help!

16 Replies
tresesco
MVP
MVP

Try like:

Load * ;

SQL Select Distinct Column1,

           Column2,

           ACCT

From Account_Table;

Not applicable

Why don't you create a QVD for Account_Table and then use it?

Thanks,

Singh

AbhijitBansode
Specialist
Specialist

write the sql Select statement in the same syntax which you use on database.

SQL Select statements will be excuted by database engine not by QlkView.

SQL Select statements are send to the database by QlikView for excution and result s returned in hte QlikView.

Hence all the SQL syntax would work in QlikView SQL  Statements.

qlikviewforum
Creator II
Creator II
Author

This may not improve the performance as I have huge no of records which is coming from SQL. So I want to make use of where clause in the SQL statement instead of QV load statement.

AbhijitBansode
Specialist
Specialist

Load

     *;

Sql Select * from YourTable where Field1='Yourfilter';

tresesco
MVP
MVP

I have advised to use distinct in SQL Select part, that means it gets executed in the source database and NOT in QV.

Not applicable

you can make a coma separated list variable of the ID's in f_Acct using concat functions and then pass it in SQL statement

Load

     *;

Sql Select * from YourTable where Field1 in ($(vList));

AbhijitBansode
Specialist
Specialist


Hi tresesco, your answer is 100% correct, I didn't mean to contradict your answer, I thought its better to give explanation of what you've specified.

qlikviewforum
Creator II
Creator II
Author

Hi,

I tried doing that but as the string is too long in the ($(vList)) variable, oracle is throwing the error("string literal too long"). I think I need to split the string into half then try doing it into using two IN clause in the SQL.

Any suggestions on how to achieve this?