5 Replies Latest reply: Oct 12, 2011 10:00 AM by Paul Nockolds RSS

    Allowing the user to specify the date for SQL statement WHERE clause

    Paul Nockolds

      Hi All

       

      I have the following SQL statement in my script which works fine with a hard coded date, but, is there a way to allow the user to provide the date for the WHERE clause?  Can i use a mapping table within the SQL so perhaps the user could update a mapping spreadsheet when they need to?

       

      Any ideas welcome...

       

      ODBC CONNECT TO QlikView (XUserId is TaDfPUJMJbXIWSZOfScKWQRMFTcII, XPassword is LSTEecYNJCaMDTJKFJWOFLC);
      
      HBI_temp:
      SELECT
          userEmail
          ,usertitle
          ,userfirstname
          ,userlastname
          ,userid
          ,dateadded
      
      FROM
          tbl_Users
      
      WHERE
          dateadded > '2011-10-02'            //<<<<<<<<<<< date i would like to make more dynamic <<<<<<<<<<<<<<<
      ;
      HBI_Data:
      LOAD
          userEmail           as Email
          ,usertitle             as Title
          ,userfirstname     as Firstname
          ,userlastname     as Lastname
          ,userid                as userid   
          ,dateadded          as From_Date
      Resident
          HBI_temp;
      
      DROP Table
          HBI_temp;