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

Announcements
ALERT: QlikView server communication interruptions following Microsoft Windows Domain Controller security updates
cancel
Showing results for 
Search instead for 
Did you mean: 
rahulsingh12
Contributor III
Contributor III

Not Exists

Hi

I have a table with two ID columns Primary_ID and FK_ID.

The Primary_ID contains the  FK_ID also ,so while loading the scipt I want the PrimaryID which are not the FK_ID .

How can I do it at a script level while loading the data.

Is there anything like not exist for script level restriction.

Regards,

Labels (1)
14 Replies
antoniotiman
Master III
Master III

Yes You are right, 'That actually depends'.

If all values of PK are in Primary, then 2nd LOAD gets 0 Rows.

Muthu
Partner - Creator III
Partner - Creator III

Hi Rahul,

Tresesco is right, You can use that script to load the Primary key which are not FK_ID.

Regards,

Muthu

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Hi Tres.

Just a remark. Isn't it the other way around? The OP says "The Primary may contain FK id but we want only the one's which are not in FK.".

Shouldn't the second LOAD rather be something like this?

t2:

NOCONCATENATE

LOAD * RESIDENT t1 WHERE Not Exists(FKID, PK);

tresB
Champion III
Champion III

Yes you are right. I have to read more carefully.   Corrected the order.

effinty2112
Master
Master

Hi rahul,

Something like:

Temp:

Load FK_ID as NoPrimaryLikeThisID From SourceTable;


Load * From SourceTable Where NotExists(NoPrimaryLikeThisID, Primary_ID);


Drop table Temp;


Cheers

Andrew