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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

load subquery conditional

Dears,

I'm facing a problem:

This is a database query which I would want to run on a QV table (using a load statement and a QVD as source).


SELECT ID,PREDECESSOR_ID,STATUS,...
FroM T1
WHERE
ID not in (SELECT PREDECESSOR_ID FROM T1) AND
STATUS=OK


Goal: only display rows of table T1 for which there is no similar ID entry anywhere in the table within the PREDECESSOR_ID column.

For some reason I don't get this working.
I tried also with set analysis, but this brought me even more off track.

FYI: There is no possibility to run the query on the database directly.

Any other approach is perfect.
In fact, I only need to know the number of records resulting of the query.

Thanks in advance!

Kind regards,
Maarten

Labels (1)
1 Solution

Accepted Solutions
deepakk
Partner - Specialist III
Partner - Specialist III

hi,

Try this.

First store the Table in QVD then use the below code

Load ID, PREDECESSOR_ID,.....

from T1

Load

PREDECESSOR_ID as ID

from T1 where not exists (ID,PREDECESSOR_ID ) and Status = 'OK';

I hope this helps.

View solution in original post

2 Replies
deepakk
Partner - Specialist III
Partner - Specialist III

hi,

Try this.

First store the Table in QVD then use the below code

Load ID, PREDECESSOR_ID,.....

from T1

Load

PREDECESSOR_ID as ID

from T1 where not exists (ID,PREDECESSOR_ID ) and Status = 'OK';

I hope this helps.

Not applicable
Author

Thanks a lot! That did the job!