Skip to main content

Can anyone please help me to get Last two months records  for particular object in Apex Class ( how to write condition for that )

 

Currently Using below condition  in Query 

 

CreatedDate = LAST_N_MONTHS:2 AND CreatedDate < LAST_N_MONTHS:1

 

Thanks in Advance

 

#Salesforce Developer

1 answer
  1. Lakhan Meghani (NA) Forum Ambassador
    Oct 6, 2021, 9:05 AM

    Hey Rakesh,

     

    use this-

    Select Id,CreatedDate FROM contact Where CreatedDate = LAST_N_MONTHS:2

0/9000