Answers.Body: <p>This error will occur if you have missing/inactive Batch Status. To check navigate to CiviCRM >> Administer >> System Settings >> Option Groups. Search for <strong>Batch Status</strong> and then click on <strong>options</strong> link besides it.</p>
  
  <p>You should see 'Data Entry' if not then you will need to add it as it is required by CiviCRM or enable it if its disabled. </p>
  
  <blockquote>
    <p><strong>Note from Paul:</strong>  It existed and was enabled; however, it had a value of 0 as did Reopen and Export. I looked at a demo and saw they
    have other values. Just hitting the Edit in order Data Entry, Reopen,
    Export and saving caused them automatically have the right value. That
    fixed the issue. Add this info to your answer and I'll check it and up
    vote it.</p>
  </blockquote>
  
  <p>HTH</p>
  
  <p>Pradeep</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-13T17:49:41.900Z
Answers.Text: Thanks for the answer.  It lead me in the right direction.  It existed and was enabled; however, it had a value of 0 as did Reopen and Export.  I looked at a demo and saw they have other values.  Just hitting the Edit in order Data Entry, Reopen, Export and saving caused them automatically have the right value.  That fixed the issue.  Add this info to your answer and I'll check it and up vote it.
Answers.UserDisplayName: Paul-Tahoe
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-14T12:10:33.893Z
Answers.Text: Added now to my answer
Answers.UserDisplayName: Pradeep Nayak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2018-09-13T16:19:53.897Z
Answers.LastActivityDate: 2018-09-14T12:10:21.213Z
Answers.LastEditDate: 2018-09-14T12:10:21.213Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>Upgraded from 4.6.38 to 5.4.0 in a test env.  The Donor Report (Summary) and (Detail) both fail on this piece of sql</p>
  
  <pre><code> SELECT id, title 
   FROM civicrm_batch 
   WHERE item_count &gt;= 1 
   AND status_id != 
   ORDER BY title
  </code></pre>
  
  <p>Clearly the status_id is missing.</p>
  
  <p>I then upgraded to 5.5.0 hoping maybe that would fix it, nope.  </p>
  
  <p>civicrm_batch has no rows so I'm guessing it queries it for some batch id gets back null and sticks that into the query.</p>
  
  <p>I tried to create some batches both open and closed for all the possibilities I think there are.  That didn't help.</p>
  
Tags: <civicontribute><reports>
Title: Upgraded to 5.4, Donor Report fails with bad sql. Status_id is missing
ThreadText: # Upgraded to 5.4, Donor Report fails with bad sql. Status_id is missing
  
  (Asked by: username_0 on 2018-09-12)
  
  Upgraded from 4.6.38 to 5.4.0 in a test env.  The Donor Report (Summary) and (Detail) both fail on this piece of sql
   SELECT id, title 
   FROM civicrm_batch 
   WHERE item_count >= 1 
   AND status_id != 
   ORDER BY title
  
  Clearly the status_id is missing.
  I then upgraded to 5.5.0 hoping maybe that would fix it, nope.  
  civicrm_batch has no rows so I'm guessing it queries it for some batch id gets back null and sticks that into the query.
  I tried to create some batches both open and closed for all the possibilities I think there are.  That didn't help.
  
  **Tags:** civicontribute, reports
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2018-09-13. Score: 2 | Accepted answer
  
  This error will occur if you have missing/inactive Batch Status. To check navigate to CiviCRM >> Administer >> System Settings >> Option Groups. Search for **Batch Status** and then click on **options** link besides it.
  
  You should see 'Data Entry' if not then you will need to add it as it is required by CiviCRM or enable it if its disabled.
  
  > **Note from Paul:** It existed and was enabled; however, it had a value of 0 as did Reopen and Export. I looked at a demo and saw they
  > have other values. Just hitting the Edit in order Data Entry, Reopen,
  > Export and saving caused them automatically have the right value. That
  > fixed the issue. Add this info to your answer and I'll check it and up
  > vote it.
  
  HTH
  
  Pradeep
  
  > **Comments:**
  > **username_0**: Thanks for the answer.  It lead me in the right direction.  It existed and was enabled; however, it had a value of 0 as did Reopen and Export.  I looked at a demo and saw they have other values.  Just hitting the Edit in order Data Entry, Reopen, Export and saving caused them automatically have the right value.  That fixed the issue.  Add this info to your answer and I'll check it and up vote it.  
  > **username_1**: Added now to my answer  
  
  ---
  
  