1 resposta

Hi Preyanka,You can do this in a single query.-first you have to make the instance of the dates.Date d1 = Date.newInstance(2019,3,10);Date d4 = Date.newInstance(2019,3,20);Date d2 = Date.newInstance(2019,2,18);Date d3 = Date.newInstance(2019,2,25);-here is your query:-List<Account> acc=[select Id from Account where (CreatedDate >=: d1 AND CreatedDate <=: d2) OR (CreatedDate >=: d3 AND CreatedDate <=: d4) LIMIT 10000];-Please check the condition of greater than and less than according to your need.I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.Thanks and Regards,Deepali Kulshrestha