Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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();

1 Solution

Accepted Solutions
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

talk is cheap, supply exceeds demand

View solution in original post

2 Replies
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

talk is cheap, supply exceeds demand
Anonymous
Not applicable
Author

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

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