Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Nested Select SQL Where Clause

Wondering if I can do a nested select SQL statement in QLikview script... Qlikview seems grouchy though, however, I'm certain my syntax is not correct...

I have a QlikView file:TEMPFILE with only one "SchoolCode" field that contains distinct SchoolCode values.

So,

I want to LOAD new data from a database... using only data with SchoolCodes that are in the tempfile...

LOAD * From DBO.TABLENAME

WHERE SchoolCodes IN (select distinct SchoolCode from TEMPFILE)

;

What am I doing wrong?

Stephanie

7 Replies
martin59
Specialist II
Specialist II

Hello Stephanie,

You can do :


TempFile:
LOAD SchoolCode FROM TempFile.xls;
Table:
LOAD * FROM DBO.TABLENAME WHERE EXISTS (SchoolCode);


Hope it's gonna be helpful.

Martin

martin59
Specialist II
Specialist II

Hello Stephanie,

You can do :


TempFile:
LOAD SchoolCode FROM TempFile.xls;
Table:
LOAD * FROM DBO.TABLENAME WHERE EXISTS (SchoolCode);


Hope it's gonna be helpful.

Martin

Not applicable
Author

Load your temp file in memory:


LOAD * FROM TEMPFILE.qvd (qvd);


After execute the SQL Statement:


LOAD * WHERE exists(SchoolCode);
SQL SELECT * FROM DBO.TABLENAME;


Not applicable
Author

USE THE SQL COMMAND IN PLACE OF LOAD


SQL SELECT *
FROM DBO.TABLENAME
WHERE SCHOOLCODES IN (SELECT DISTINCT SCHOOLCODE FROM TEMPFILE)


REGARDS
TONIAL.

Not applicable
Author

You folks are awesome. Thanks a bunch... I understand SQL... but mixing QlikView Scripting experience with it is where I am lacking.

Thanks again for the responses, I tried each of the methods as well.

Stephanie Lind

Not applicable
Author

HI

I like to find out how to do a IN criteria when using a qvd load or a resident load.

Thanks

laurens
Contributor III
Contributor III

Hi Jack,

With QVD load You need use the match-function.

load * from ???.qvd where match(fieldname,value1,value2,...);