title: Create Batch Apex to update multiple objects
body: <p>I already have a Schedule apex, that works on 3 objects to do a basic Query and update. I wanted to make this class batch. But unable to add multiple objects in Batch apex and loop around them . </p>
  
  <p>Here is how my Schedule apex looks like </p>
  
  <pre><code>`global class scheduleWorkday implements Schedulable {
  
   global void execute(SchedulableContext ctx) {
  
    //Get Accounts
  
          List&lt;Account&gt; getbdayaccount = [Select ID, Name, Address from Account where State= CT];
  
          if(!getbdayaccount .isEmpty()) {
                  for(Account a : getbdayaccount ) {
                  a.name = 'Test';
                  a.State= 'NJ';
              }
              update getbdayaccount ;
          }
  
  //get Leads 
  
     List&lt;Lead&gt; getPreApprovalFollow = [Select ID, Name, State, LeadSource from Lead where State = 'CT' ];
  
          if(!getPreApprovalFollow .isEmpty()) {
                 for(Lead l: getPreApprovalFollow ) {
                  l.LeadSource = 'Referral';
                  l.State = 'NJ';
              }
              update getPreApprovalFollow ;
          }
  
  //get Opportunities 
  
  List&lt;Opportunity&gt; getopps = [Select Id, CloseDate, State from Lead where State = 'CT'];
  
     if(!getopps.isEmpty()){
       for(Opportunity o : getopps){
       o.CloseDate = Date.Today();
        o.State = 'CT';
  }
  update get opps;
  
  
  }
  
  
  
  }
  
  
  }`
  </code></pre>
  
  <p>I  tried making batch apex something like this - </p>
  
  <pre><code>global class LeadProcessor implements Database.Batchable &lt;SObject&gt; {
  //START METHOD
      global Database.QueryLocator start(Database.BatchableContext bc){
          String Query='Select id,LeadSource, State from Lead where state = 'CT';
          return Database.getQueryLocator(Query);
              }
  //EXECUTE METHOD
      global void execute(Database.BatchableContext bc, List&lt;Lead&gt; scope){
          for(Lead l: scope){
              l.LeadSource='Referral';
              l.State = 'NJ';
  
          }
          update scope;
      }
  //FINISH METHOD
      global void finish(Database.BatchableContext bc){
  
      }
  }
  </code></pre>
  
  <p>How can I change this batch apex to return multiple queries, add a loop  and update them . </p>