3 Replies Latest reply: Apr 4, 2013 6:10 PM by Brian Keilig RSS

    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?