I am running an SOQL query to get 10th, 30th and 60th days before created records to notify users to take action. I wrote a query using LAST_N_DAYS:10 OR LAST_N_DAYS:30 in WHERE condition, but the expected results are not coming. I will have to write my own date logic behind to get it to work but why the out of the box feature in SOQL is not returning expected records. Am I doing any mistake here?
SELECT Id, LastModifiedDate FROM Account WHERE LastModifiedDate = LAST_N_DAYS:10
In the above Query, my understanding is that we are supposed to get the records which are modified 10 days back. But the results are some random dated records. Please refer to the screenshot below.
This is the same for CreatedDate and other dateTime datatype field in other custom object as well. Please advice. Thank you.
LAST_N_DAYS:10
means anything updated starting today until 10 days back.