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: 
saurabh5
Creator II
Creator II

creating variable for a condition in SQL querry to load data


hi all,

i want to load some data in Qlikview and create a qvd for the same.

i have the following query

SQL Select   *

from  xyz.FACT, xyz.DIR

WHERE FACT.STARTING_DATE <= DIR.DATE_REC

       AND FACT.ENDING_DATE > DIR.DATE_REC

       AND FACT.FLG='N'  AND

FACT.TESTER ='PERF';

But i want to create variable for the condition (FACT.STARTING_DATE <= DIR.DATE_REC

  AND FACT.ENDING_DATE > DIR.DATE_REC)    so  that i pick only the max value from the database

thanks in advance!!

3 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

You want a SQL Query or a QlikView LOAD statement?

saurabh5
Creator II
Creator II
Author

hi Peter,

i want a way to create a variable like vmaxofdate= for the condition FACT.STARTING_DATE <= DIR.DATE_REC  AND FACT.ENDING_DATE > DIR.DATE_REC so that i pick only those rows from database in qv

thanks

its_anandrjs
Champion III
Champion III

Hi,

How you store the Max value of DIR.DATE_REC if it is from any table then store this information with help of the Peek function and then load SQL load statement and then in Qlikview do Where condition.

//Sql Load

Table1:

SQL Select   *

from  xyz.FACT, xyz.DIR;


Noconcatenate

Load *

Resident Table1

WHERE FACT.STARTING_DATE <= $(vMaxDateRec)

       AND FACT.ENDING_DATE > $(vMaxDateRec)

       AND FACT.FLG='N'  AND

         FACT.TESTER ='PERF';

Drop Table Table1;

Let me know about the Max value.

Regards

Anand