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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

SQL exists in Qlikview

Hi,

I am trying to create a logic that i have worked out in SQL,

but i don't know how to craete it in qlikview script.

I have a table that describes ads, on a dialy level,

which says if the ad had an Upgrade ad (there are many types of upgrades, like: boost, premiumm, etc.),

or a base ad,

my goal is to take only premium ads WHICH HAD IN THE SAME DAY a basic ad

Example:

table name: Fact

Columns: id, upgarde, date

SELECT *

FROM Fact AS a

WHERE (a.upgrade='premium' OR a.upgrade='boost')

EXISTS (SELECT * FROM Fact AS b     WHERE upgrade='basic' AND a.id=b.id AND a.date=b.date)

*note: there a 10 types of premium, so i may see situations like:

column: id, upgrade, date

values: 123, basic, 1.1.2015

             123, premium, 1.1.2015

             123, boost, 1.1.2015

11 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

It was a guess. Someone has to fetch the data from a database. Inserting a QVD buffer in your data flow is only useful if you either plan to use the QVD in other documents, or you need the source table in the same document many times.

If this is the only time you will be reading the source table, you can do it with this very simple SELECT on the source DB. The overhead on the RDBMS is very low, even for millions of rows.

If your situation is different, replace the SQL SELECT with a sub-second QVD read like:

TempFact:

LOAD * FROM [SourceTable.qvd] (qvd); // Optimized LOAD = very fast

Best,

Peter

Anonymous
Not applicable
Author

Thank You