For writing a query in developer console, follow certain Steps :
Click on your name i.e. on top right corner ( as shown in Screenshot 1 ).Click on Debug --> then Click on Open Execute Anonymous Window ( as shown in Screenshot 2).A sub window will appear and write the query in that window and then select the query and click on Executed Highlighted. ( as shown in Screenshot 3 ).
For deleting the records, Please try to use the following code :
List<sendgrid4sf__SendGrid_Email_Status__c> obj1 = new list<sendgrid4sf__SendGrid_Email_Status__c>();
List<sendgrid4sf__SendGrid_Email_Status__c> obj2 = new list<sendgrid4sf__SendGrid_Email_Status__c>();
obj1=[Select id, createddate from sendgrid4sf__SendGrid_Email_Status__c where createddate<=:system.now().addDays(-30) LIMIT 9999];
System.debug('obj----' + obj1);
For(sendgrid4sf__SendGrid_Email_Status__c obj3 : obj1)
{
obj2.add(obj3);
}
delete obj2;
MassMailer Team