Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

WHERE EXISTS syntax

Qlik is a great product, but its documentation is sadly behind.

I am trying to add a field to an existing QVD. Following advice in the community, I used the following:

RefNote:

Load

  *

FROM GM1988AndOnwardNotes.qvd (qvd);

// The 'Records' field in the above QVD was aliased from "RECID" for backwards compatibility

// Now I want to add the REF field to the QVD, joining on the RECID (1:1 with existing QVD)

JOIN

LOAD

  Records,

  REF;

SQL Select

  RECID AS Records,

  REF

FROM

  CONTHIST; // this code taken (with obvious field name changes) from a community post

This actually works fine. However, where there 800k records in the QVD, the new load generated 1.1 million records, so I wanted to restrict the load to only records that already existed I tried adding a WHERE clause

WHERE EXISTS (Records). This got an error "wrong syntax near Records".

Did a little more digging, saw that I apparently need the field name from both the existing QVD and the

new table in the EXISTS, so I tried

WHERE EXISTS (Records, RECID), but that also got a syntax error, as did every possible combination

(e.g. (RECID, Records), (Records, RECID), (RECID,RECID) and (Records, Records).

What is the correct syntax for this?

thanks,

Kevin

12 Replies
ramoncova06
Specialist III
Specialist III

Sunny already replied back to the original question, if you want to use a where exists, you first have to use the field that already exists and then use the new field

Not applicable
Author

Sorry, Henric, my mail cut off your reply at "You don't need it..." and I didn't see the rest of your comment. Apologies for the above post. Thanks for the answer.

sangeeth8787
Contributor III
Contributor III

Can i use where exist condition instead of where clause.

 

I have situation, one of the previous developer created load script as 

 

Load *

from 

x.qvd(qvd)

where color = 'red' and year = 2018.

 

Because of two where conditions, the load is not optimized, how can we create the above load script with 2 conditions as optimized load. I have been searching in community but I haven't got much luck, could you please provide some hint on this scenario. Many Thanks in Advance