select id from Opportunity where CreatedDate < LastModifiedDate LIMIT 1;
Why there is parsing error when we compare CreatedDate and LastModifiedDate?
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communitySalesforce does not allow direct field to field comparison in SOQL query. Workaround for this is mentioned here
In your case, add new formula checkbox field called CreatedLessThenModified__c
on Opportunity:
CreatedDate < LastModifiedDate
then the following soql will work:
select id
from Opportunity
where CreatedLessThenModified__c = true
limit 1;