function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Prem ChauhanPrem Chauhan 

CreatedDate != LastModifiedDate In SOQL ?? Urgent.

Object: Lead/Account 
SOQL is not working can anyone help me. 
My Query: [SELECT ID, Name FROM LEAD WHERE CreatedDate != LastModifiedDate ];

Error:  Unknown error parsing query
Best Answer chosen by Prem Chauhan
Ahmed Ansari 13Ahmed Ansari 13

Hi Prem 

Salesforce does not allow direct field to field comparison in SOQL query. Workaround for this is mentioned here (http://
In your case, add new formula checkbox field called CreatedDateNotEqualToLastModified__c

on Lead:

CreatedDate != LastModifiedDate

then the following soql will work:

[Select Id, Name from Lead where CreatedDateNotEqualToLastModified__c =true]

If this help please mark it