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
PRASHANT BHARTIPRASHANT BHARTI 

SOQL to fetch records

SOQL to fetch records which has been created over 2 years and no update on those records.
Sanjay Bhati 95Sanjay Bhati 95
Hi Prashant Bharti,

You can use below query to get the records created over 2 years then loop on that query and check that createdDate == lastmodified date.
 
Select Id,Name,CreatedDate,LastModifiedDate From Account Where CreatedDate >= Last_N_YEARS:2 and LastMOdifiedDate