Answers.Body: <p>I just ran into this - got it working - (4.6 line numbers) - just need to update the field names (see below). After applying the patch clear caches (the views cache in particular).</p>
  
  <p>I do not have CiviCRM Entity installed for this project - this is a straight up CiviCRM Views integration/fix.</p>
  
  <pre><code>diff --git a/drupal/modules/views/components/civicrm.contribute.inc b/drupal/modules/views/components/civicrm.contribute.inc
  index e666a45..1b4a20f 100644
  --- a/drupal/modules/views/components/civicrm.contribute.inc
  +++ b/drupal/modules/views/components/civicrm.contribute.inc
  @@ -1023,7 +1023,7 @@ function _civicrm_contribute_data(&amp;$data, $enabled) {
       ),
     );
     //Recurring Contribution End Date
  -  $data['civicrm_contribution_recur']['next_sched_contribution'] = array(
  +  $data['civicrm_contribution_recur']['next_sched_contribution_date'] = array(
       'title' =&gt; t('Next Contribution Date'),
       'help' =&gt; t('The Next Contribution Date.'),
       'field' =&gt; array(
  @@ -1040,7 +1040,7 @@ function _civicrm_contribute_data(&amp;$data, $enabled) {
     );
     civicrm_views_add_date_arguments($data['civicrm_contribution_recur'], array(
       'title' =&gt; 'Recurring Contribution Next Date',
  -      'name' =&gt; 'next_sched_contribution',
  +      'name' =&gt; 'next_sched_contribution_date',
       ));
     //How many times has the contribution failed
     $data['civicrm_contribution_recur']['failure_count'] = array(
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-23T01:04:49.830Z
Answers.LastActivityDate: 2017-04-23T01:04:49.830Z
Answers.UserDisplayName: KarinG - Semper IT
Answers.Body: <p>That particular table is exposed to Views by the Core CiviCRM module, not CiviCRM entity.  I haven't exposed that entity to Drupal yet, but its on the todo list. </p>
  
  <p>I have added some code to CiviCRM Entity to fix this...</p>
  
  <p>Its available in the latest -dev release from the <a href="https://www.drupal.org/project/civicrm_entity" rel="nofollow noreferrer">CiviCRM Entity project page</a>
  and will be in beta7 when it is released</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-04-18T01:11:03.330Z
Answers.LastActivityDate: 2017-04-18T01:11:03.330Z
Answers.UserDisplayName: jackrabbithanna
Body: <p>I'm trying to create a view that will tell our logged-in Drupal users when their next scheduled contribution is slated to happen.  Everything is working well until I add the field &quot;CiviCRM Recurring Contributions: Next Contribution Date&quot;.  When that happens, my preview gives the error:</p>
  <blockquote>
  <p>SQLSTATE[42S22]: Column not found: 1054 Unknown column
  'civicrm_contribution_recur.next_sched_contribution' in 'field list'</p>
  </blockquote>
  <p>The Views SQL query shows this field being called:</p>
  <pre><code>civicrm_contribution_recur.next_sched_contribution AS civicrm_contribution_recur_next_sched_contribution
  </code></pre>
  <p>That is the correct table, but the field name is incorrect.  It should be <code>next_sched_contribution_date</code>.  I've tried searching in the <a href="https://www.drupal.org/project/civicrm_entity" rel="nofollow noreferrer">CiviCRM Entity</a> <a href="https://github.com/eileenmcnaughton/civicrm_entity" rel="nofollow noreferrer">Github repo</a>, but I can't find where the (incorrect) field name is being generated.  Where would I look to find the error?  Or am I looking in the wrong place entirely and it's not a CiviCRM Entity issue at all?  I want to help, I just don't know where to correct it.</p>
  <p>We're using Drupal 7, CiviCRM 4.6.21, CiviCRM Entity module 7.x-2.0-beta3.  The type of view is &quot;CiviCRM Recurring Contribution profile.&quot;</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-11-11T05:36:02.010Z
Comments.Text: Hi Allen - I am not clear. Are using the civicrm_entity module. if so is your view built on the standard 'contribution' or on the entity contribution base
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2016-11-11T05:40:38.320Z
Comments.Text: Hi Pete, thanks for asking and helping me remember what I forgot to post. :) I've updated the question.  Yes on the CiviCRM-Entity module.  Using the view type of "CiviCRM Recurring Contribution profile", not the "CiviCRM Recurring Entity."
Comments.UserDisplayName: Allen Hutchison
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-04-18T00:24:29.767Z
Comments.Text: In the future, the best place to get support for CiviCRM Entity is via the module's issue queue, https://www.drupal.org/project/issues/civicrm_entity?status=All&categories=All
Comments.UserDisplayName: jackrabbithanna
Tags: <drupal><drupal-views><recurring-contributions><civicrm-entity>
Title: How can I fix an incorrect SQL field in Recurring Contribution View?
ThreadText: # How can I fix an incorrect SQL field in Recurring Contribution View?
  
  (Asked by: username_0 on 2016-11-10)
  
  I'm trying to create a view that will tell our logged-in Drupal users when their next scheduled contribution is slated to happen.  Everything is working well until I add the field "CiviCRM Recurring Contributions: Next Contribution Date".  When that happens, my preview gives the error:
  
  SQLSTATE[42S22]: Column not found: 1054 Unknown column
  'civicrm_contribution_recur.next_sched_contribution' in 'field list'
  
  The Views SQL query shows this field being called:
  civicrm_contribution_recur.next_sched_contribution AS civicrm_contribution_recur_next_sched_contribution
  
  That is the correct table, but the field name is incorrect.  It should be next_sched_contribution_date.  I've tried searching in the CiviCRM Entity Github repo, but I can't find where the (incorrect) field name is being generated.  Where would I look to find the error?  Or am I looking in the wrong place entirely and it's not a CiviCRM Entity issue at all?  I want to help, I just don't know where to correct it.
  We're using Drupal 7, CiviCRM 4.6.21, CiviCRM Entity module 7.x-2.0-beta3.  The type of view is "CiviCRM Recurring Contribution profile."
  
  **Tags:** drupal, drupal-views, recurring-contributions, civicrm-entity
  
  > **Comments:**
  > **username_1**: Hi Allen - I am not clear. Are using the civicrm_entity module. if so is your view built on the standard 'contribution' or on the entity contribution base  
  > **username_0**: Hi Pete, thanks for asking and helping me remember what I forgot to post. :) I've updated the question.  Yes on the CiviCRM-Entity module.  Using the view type of "CiviCRM Recurring Contribution profile", not the "CiviCRM Recurring Entity."  
  > **username_2**: In the future, the best place to get support for CiviCRM Entity is via the module's issue queue, https://www.drupal.org/project/issues/civicrm_entity?status=All&categories=All  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_3 on 2017-04-23. Score: 1 | Accepted answer
  
  I just ran into this - got it working - (4.6 line numbers) - just need to update the field names (see below). After applying the patch clear caches (the views cache in particular).
  I do not have CiviCRM Entity installed for this project - this is a straight up CiviCRM Views integration/fix.
  diff --git a/drupal/modules/views/components/civicrm.contribute.inc b/drupal/modules/views/components/civicrm.contribute.inc
  index e666a45..1b4a20f 100644
  --- a/drupal/modules/views/components/civicrm.contribute.inc
  +++ b/drupal/modules/views/components/civicrm.contribute.inc
  @@ -1023,7 +1023,7 @@ function _civicrm_contribute_data(&$data, $enabled) {
       ),
     );
     //Recurring Contribution End Date
  -  $data['civicrm_contribution_recur']['next_sched_contribution'] = array(
  +  $data['civicrm_contribution_recur']['next_sched_contribution_date'] = array(
       'title' => t('Next Contribution Date'),
       'help' => t('The Next Contribution Date.'),
       'field' => array(
  @@ -1040,7 +1040,7 @@ function _civicrm_contribute_data(&$data, $enabled) {
     );
     civicrm_views_add_date_arguments($data['civicrm_contribution_recur'], array(
       'title' => 'Recurring Contribution Next Date',
  -      'name' => 'next_sched_contribution',
  +      'name' => 'next_sched_contribution_date',
       ));
     //How many times has the contribution failed
     $data['civicrm_contribution_recur']['failure_count'] = array(
  
  
  ---
  
  ### Answer by username_2 on 2017-04-18. Score: 2
  
  That particular table is exposed to Views by the Core CiviCRM module, not CiviCRM entity. I haven't exposed that entity to Drupal yet, but its on the todo list.
  
  I have added some code to CiviCRM Entity to fix this...
  
  Its available in the latest -dev release from the [CiviCRM Entity project page](https://www.drupal.org/project/civicrm_entity)
  and will be in beta7 when it is released
  
  
  ---
  
  