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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using the WHERE Clause in an ODBC connection string

Hello,

Can anybody confirm whether or not I can use a WHERE clause in an ODBC connection?

For example:

I am able to connect to a MS Access Database and return all values as per below:

Script:

 

ODBC CONNECT32 TO [MS Access Database;DBQ=C:\Users\hayetom\Qlikview\Examples\Product.accdb];

LOAD `Product_ID`,

    `Product_Line`;

SQL SELECT *

FROM `DIM_Prod`;

Which returns:

Product_IDProduct_Line
1VL
2VL
3AB
4AB
5AB
6CD
7CD
8EF

However, I only want to return rows Where the Product_Line is either 'VL' or 'AB'. I have tried

ODBC CONNECT32 TO [MS Access Database;DBQ=C:\Users\hayetom\Qlikview\Examples\Product.accdb];

LOAD `Product_ID`,

    `Product_Line`;

SQL SELECT *

FROM `DIM_Prod` WHERE (Product_ID = 'VL' or Product_ID = 'AB');

NOTE: I appreciate that I can bring all the rows in and then limit my selection on the resident Load BUT I want to limit the data that is brought in the qvw to begin with.

Any ideas?

1 Solution

Accepted Solutions
Not applicable
Author

Try using Product_Line in your Where clause, rather than Product_ID

View solution in original post

3 Replies
Larry_Aaron
Employee
Employee

Try this for your where clause.

where Product_ID in('VL','AB')

danielrozental
Master II
Master II

Try referring to the field as it appears in the SELECT.

where `Product_ID` in('VL','AB')

Not applicable
Author

Try using Product_Line in your Where clause, rather than Product_ID