How to Filter Salesforce Data by Date Field with Custom SQL
Published: 02 Oct 2023 Last Modified Date: 03 Oct 2023
How can we filter Salesforce data by a date field with custom SQL?
When connecting to Salesforce data with custom SQL, you need to write a SOQL compliant query. You can specify date values or date literals in the WHERE clauses to filter SOQL query results referring to Date Formats and Date Literals in WHERE.
SELECT CaseNumber, CreatedDate FROM Case WHERE CreatedDate > 2023-01-01T00:00:00Z
For more information on the Salesforce Object Query Language (SOQL), view Salesforce Help.