2 Replies Latest reply: Jan 16, 2015 8:58 AM by Robert Fishel RSS

    Salesforce SQL select not in future

      Hi all,

       

      i am trying to ensure no scheduled Salesforce Activities in the future are loaded, but my WHERE clause doesn't seem to be correct. What am I doing wrong?

       

       

      Activities:

      LOAD Id AS ActivityId,

          'eCommerce' AS ActivityOrg,

          Subject,

          ActivityDate AS CalendarDate,

          OwnerId,

          Description AS eCommercePublicNotes,

          Type;

      SQL SELECT *

      FROM Task

      WHERE ActivityDate <= Today();

        • Re: Salesforce SQL select not in future
          Gysbert Wassenaar

          Today() is a qlikview function. You can't use qlikview functions in SQL statements since those are processed by the dbms and not by qlikview. According to SalesForce.com SOQL and SOSL Reference you can use TODAY instead.

           

          Date Literals

          A fieldExpressioncan use a date literal to compare a range of values to the value in adateordateTimefield. Each literal is a range of time beginning with midnight (12:00:00). To find a value within the range, use=. To find values on either side of the range, use>or<. The following table shows the available list of date literals, the ranges they represent, and examples:

           

          Date LiteralRangeExample
          YESTERDAYStarts 12:00:00 the day before and continues for 24 hours.SELECT Id FROM Account WHERE CreatedDate = YESTERDAY
          TODAYStarts 12:00:00 of the current day and continues for 24 hours.SELECT Id FROM Account WHERE CreatedDate > TODAY
          • Re: Salesforce SQL select not in future
            Robert Fishel

            I don't think you can use Today() in a SQL SELECT query.  Try something like:

             

            WHERE ActivityDate = #" & format(Date,"mm/dd/yyyy") & "#"