+ Start a Discussion

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