Answers.Body: <p>This is a new bug in 4.6.5 :-(</p>
  
  <p><a href="https://issues.civicrm.org/jira/browse/CRM-16858" rel="nofollow">https://issues.civicrm.org/jira/browse/CRM-16858</a></p>
  
  <p>I would expect 4.6.6 to be out fairly quickly to remedy it - or you can apply patches from the list. </p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-07-21T12:32:50.143Z
Answers.LastActivityDate: 2015-07-21T12:32:50.143Z
Answers.UserDisplayName: eileen
Body: <p>Worked fine with Drupal 7.37 core and CiviCRM 4.6.2.</p>
  
  <p>Updated site to 7.38 core and Civi 4.6.5, then get an error for all of my events when trying to display Participants from "Manage Events" page.</p>
  
  <p>Error trace shows the following:</p>
  
  <pre><code>Database Error Code: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0 AND civicrm_participant.is_test = 0 ) AND (contact_a.is_deleted = 0)' at line 3, 1064
  Additional Details:
  Array
  (
      [callback] =&gt; Array
          (
              [0] =&gt; CRM_Core_Error
              [1] =&gt; handle
          )
  
      [code] =&gt; -2
      [message] =&gt; DB Error: syntax error
      [mode] =&gt; 16
      [debug_info] =&gt; SELECT count( DISTINCT  civicrm_participant.id )  FROM civicrm_contact contact_a LEFT JOIN civicrm_note ON ( civicrm_note.entity_table = 'civicrm_contact' AND
                                                          contact_a.id = civicrm_note.entity_id )  LEFT JOIN civicrm_participant ON civicrm_participant.contact_id = contact_a.id  INNER JOIN civicrm_event ON civicrm_participant.event_id = civicrm_event.id  LEFT JOIN civicrm_option_group option_group_event_type ON (option_group_event_type.name = 'event_type') LEFT JOIN civicrm_option_value event_type ON (civicrm_event.event_type_id = event_type.value AND option_group_event_type.id = event_type.option_group_id )  LEFT JOIN civicrm_discount discount ON ( civicrm_participant.discount_id = discount.id ) LEFT JOIN civicrm_option_group discount_name ON ( discount_name.id = discount.price_set_id )  LEFT JOIN civicrm_option_group option_group_participant_role ON (option_group_participant_role.name = 'participant_role') LEFT JOIN civicrm_option_value participant_role ON (civicrm_participant.role_id = participant_role.value
                                 AND option_group_participant_role.id = participant_role.option_group_id )  LEFT JOIN civicrm_participant_status_type participant_status ON (civicrm_participant.status_id = participant_status.id)  WHERE  ( civicrm_event.id = 57 AND civicrm_participant.status_id 0 AND civicrm_participant.is_test = 0 )  AND (contact_a.is_deleted = 0)     [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0 AND civicrm_participant.is_test = 0 )  AND (contact_a.is_deleted = 0)' at line 3]
      [type] =&gt; DB_Error
      [user_info] =&gt; SELECT count( DISTINCT  civicrm_participant.id )  FROM civicrm_contact contact_a LEFT JOIN civicrm_note ON ( civicrm_note.entity_table = 'civicrm_contact' AND
                                                          contact_a.id = civicrm_note.entity_id )  LEFT JOIN civicrm_participant ON civicrm_participant.contact_id = contact_a.id  INNER JOIN civicrm_event ON civicrm_participant.event_id = civicrm_event.id  LEFT JOIN civicrm_option_group option_group_event_type ON (option_group_event_type.name = 'event_type') LEFT JOIN civicrm_option_value event_type ON (civicrm_event.event_type_id = event_type.value AND option_group_event_type.id = event_type.option_group_id )  LEFT JOIN civicrm_discount discount ON ( civicrm_participant.discount_id = discount.id ) LEFT JOIN civicrm_option_group discount_name ON ( discount_name.id = discount.price_set_id )  LEFT JOIN civicrm_option_group option_group_participant_role ON (option_group_participant_role.name = 'participant_role') LEFT JOIN civicrm_option_value participant_role ON (civicrm_participant.role_id = participant_role.value
                                 AND option_group_participant_role.id = participant_role.option_group_id )  LEFT JOIN civicrm_participant_status_type participant_status ON (civicrm_participant.status_id = participant_status.id)  WHERE  ( civicrm_event.id = 57 AND civicrm_participant.status_id 0 AND civicrm_participant.is_test = 0 )  AND (contact_a.is_deleted = 0)     [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0 AND civicrm_participant.is_test = 0 )  AND (contact_a.is_deleted = 0)' at line 3]
      [to_string] =&gt; [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT count( DISTINCT  civicrm_participant.id )  FROM civicrm_contact contact_a LEFT JOIN civicrm_note ON ( civicrm_note.entity_table = 'civicrm_contact' AND
                                                          contact_a.id = civicrm_note.entity_id )  LEFT JOIN civicrm_participant ON civicrm_participant.contact_id = contact_a.id  INNER JOIN civicrm_event ON civicrm_participant.event_id = civicrm_event.id  LEFT JOIN civicrm_option_group option_group_event_type ON (option_group_event_type.name = 'event_type') LEFT JOIN civicrm_option_value event_type ON (civicrm_event.event_type_id = event_type.value AND option_group_event_type.id = event_type.option_group_id )  LEFT JOIN civicrm_discount discount ON ( civicrm_participant.discount_id = discount.id ) LEFT JOIN civicrm_option_group discount_name ON ( discount_name.id = discount.price_set_id )  LEFT JOIN civicrm_option_group option_group_participant_role ON (option_group_participant_role.name = 'participant_role') LEFT JOIN civicrm_option_value participant_role ON (civicrm_participant.role_id = participant_role.value
                                 AND option_group_participant_role.id = participant_role.option_group_id )  LEFT JOIN civicrm_participant_status_type participant_status ON (civicrm_participant.status_id = participant_status.id)  WHERE  ( civicrm_event.id = 57 AND civicrm_participant.status_id 0 AND civicrm_participant.is_test = 0 )  AND (contact_a.is_deleted = 0)     [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0 AND civicrm_participant.is_test = 0 )  AND (contact_a.is_deleted = 0)' at line 3]"]
  )
  </code></pre>
  
  <p>Looks like ( civicrm_event.id = 57 AND civicrm_participant.status_id 0 AND civicrm_participant.is_test = 0 ) is malformed and should be ( civicrm_event.id = 57 AND civicrm_participant.status_id = 0 AND civicrm_participant.is_test = 0 ), but I don't know the cause.</p>
  
Tags: <civievent><sql>
Title: Selecting Participants report from Manage Events results in: "DB Error: syntax error Return to home page." after update
ThreadText: # Selecting Participants report from Manage Events results in: "DB Error: syntax error Return to home page." after update
  
  (Asked by: username_0 on 2015-07-20)
  
  Worked fine with Drupal 7.37 core and CiviCRM 4.6.2.
  Updated site to 7.38 core and Civi 4.6.5, then get an error for all of my events when trying to display Participants from "Manage Events" page.
  Error trace shows the following:
  Database Error Code: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0 AND civicrm_participant.is_test = 0 ) AND (contact_a.is_deleted = 0)' at line 3, 1064
  Additional Details:
  Array
  (
      [callback] => Array
          (
              [0] => CRM_Core_Error
              [1] => handle
          )
  
      [code] => -2
      [message] => DB Error: syntax error
      [mode] => 16
      [debug_info] => SELECT count( DISTINCT  civicrm_participant.id )  FROM civicrm_contact contact_a LEFT JOIN civicrm_note ON ( civicrm_note.entity_table = 'civicrm_contact' AND
                                                          contact_a.id = civicrm_note.entity_id )  LEFT JOIN civicrm_participant ON civicrm_participant.contact_id = contact_a.id  INNER JOIN civicrm_event ON civicrm_participant.event_id = civicrm_event.id  LEFT JOIN civicrm_option_group option_group_event_type ON (option_group_event_type.name = 'event_type') LEFT JOIN civicrm_option_value event_type ON (civicrm_event.event_type_id = event_type.value AND option_group_event_type.id = event_type.option_group_id )  LEFT JOIN civicrm_discount discount ON ( civicrm_participant.discount_id = discount.id ) LEFT JOIN civicrm_option_group discount_name ON ( discount_name.id = discount.price_set_id )  LEFT JOIN civicrm_option_group option_group_participant_role ON (option_group_participant_role.name = 'participant_role') LEFT JOIN civicrm_option_value participant_role ON (civicrm_participant.role_id = participant_role.value
                                 AND option_group_participant_role.id = participant_role.option_group_id )  LEFT JOIN civicrm_participant_status_type participant_status ON (civicrm_participant.status_id = participant_status.id)  WHERE  ( civicrm_event.id = 57 AND civicrm_participant.status_id 0 AND civicrm_participant.is_test = 0 )  AND (contact_a.is_deleted = 0)     [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0 AND civicrm_participant.is_test = 0 )  AND (contact_a.is_deleted = 0)' at line 3]
      [type] => DB_Error
      [user_info] => SELECT count( DISTINCT  civicrm_participant.id )  FROM civicrm_contact contact_a LEFT JOIN civicrm_note ON ( civicrm_note.entity_table = 'civicrm_contact' AND
                                                          contact_a.id = civicrm_note.entity_id )  LEFT JOIN civicrm_participant ON civicrm_participant.contact_id = contact_a.id  INNER JOIN civicrm_event ON civicrm_participant.event_id = civicrm_event.id  LEFT JOIN civicrm_option_group option_group_event_type ON (option_group_event_type.name = 'event_type') LEFT JOIN civicrm_option_value event_type ON (civicrm_event.event_type_id = event_type.value AND option_group_event_type.id = event_type.option_group_id )  LEFT JOIN civicrm_discount discount ON ( civicrm_participant.discount_id = discount.id ) LEFT JOIN civicrm_option_group discount_name ON ( discount_name.id = discount.price_set_id )  LEFT JOIN civicrm_option_group option_group_participant_role ON (option_group_participant_role.name = 'participant_role') LEFT JOIN civicrm_option_value participant_role ON (civicrm_participant.role_id = participant_role.value
                                 AND option_group_participant_role.id = participant_role.option_group_id )  LEFT JOIN civicrm_participant_status_type participant_status ON (civicrm_participant.status_id = participant_status.id)  WHERE  ( civicrm_event.id = 57 AND civicrm_participant.status_id 0 AND civicrm_participant.is_test = 0 )  AND (contact_a.is_deleted = 0)     [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0 AND civicrm_participant.is_test = 0 )  AND (contact_a.is_deleted = 0)' at line 3]
      [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT count( DISTINCT  civicrm_participant.id )  FROM civicrm_contact contact_a LEFT JOIN civicrm_note ON ( civicrm_note.entity_table = 'civicrm_contact' AND
                                                          contact_a.id = civicrm_note.entity_id )  LEFT JOIN civicrm_participant ON civicrm_participant.contact_id = contact_a.id  INNER JOIN civicrm_event ON civicrm_participant.event_id = civicrm_event.id  LEFT JOIN civicrm_option_group option_group_event_type ON (option_group_event_type.name = 'event_type') LEFT JOIN civicrm_option_value event_type ON (civicrm_event.event_type_id = event_type.value AND option_group_event_type.id = event_type.option_group_id )  LEFT JOIN civicrm_discount discount ON ( civicrm_participant.discount_id = discount.id ) LEFT JOIN civicrm_option_group discount_name ON ( discount_name.id = discount.price_set_id )  LEFT JOIN civicrm_option_group option_group_participant_role ON (option_group_participant_role.name = 'participant_role') LEFT JOIN civicrm_option_value participant_role ON (civicrm_participant.role_id = participant_role.value
                                 AND option_group_participant_role.id = participant_role.option_group_id )  LEFT JOIN civicrm_participant_status_type participant_status ON (civicrm_participant.status_id = participant_status.id)  WHERE  ( civicrm_event.id = 57 AND civicrm_participant.status_id 0 AND civicrm_participant.is_test = 0 )  AND (contact_a.is_deleted = 0)     [nativecode=1064 ** You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '0 AND civicrm_participant.is_test = 0 )  AND (contact_a.is_deleted = 0)' at line 3]"]
  )
  
  Looks like ( civicrm_event.id = 57 AND civicrm_participant.status_id 0 AND civicrm_participant.is_test = 0 ) is malformed and should be ( civicrm_event.id = 57 AND civicrm_participant.status_id = 0 AND civicrm_participant.is_test = 0 ), but I don't know the cause.
  
  **Tags:** civievent, sql
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-07-21. Score: 1
  
  This is a new bug in 4.6.5 :-(
  
  <https://issues.civicrm.org/jira/browse/CRM-16858>
  
  I would expect 4.6.6 to be out fairly quickly to remedy it - or you can apply patches from the list.
  
  
  ---
  
  