CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Errors when using search builder and !=
Pages: [1]

Author Topic: Errors when using search builder and !=  (Read 1247 times)

Sarah

  • I post occasionally
  • **
  • Posts: 72
  • Karma: 3
    • American Friends Service Committee - Southeastern New England
Errors when using search builder and !=
June 10, 2009, 10:34:48 am
I saw that there was an issue open for this at one time, but I was not able to determine what the current status of this is.
Can anyone tell me what is going on with search builder?

When searching for Individuals >Is Deceased> !=
I receive this error on the demo

Sorry. A non-recoverable error has occurred.

DB Error: syntax error

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 'AND contact_a.contact_type IN ('Individual') ) ) AND ( 1 )' at line 1, 1064

Return to home page.

Error Details:

Array
(
    [callback] => Array
        (
           
  • => CRM_Core_Error
  • [1] => handle
            )

       
Code: [Select]
=> -2
    [message] => DB Error: syntax error
    [mode] => 16
    [debug_info] => SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name  FROM civicrm_contact contact_a WHERE  (  ( contact_a.is_deceased !=  AND contact_a.contact_type IN ('Individual') )  )  AND  ( 1 )     [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 'AND contact_a.contact_type IN ('Individual') )  )  AND  ( 1 )' at line 1]
    [type] => DB_Error
    [user_info] => SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name  FROM civicrm_contact contact_a WHERE  (  ( contact_a.is_deceased !=  AND contact_a.contact_type IN ('Individual') )  )  AND  ( 1 )     [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 'AND contact_a.contact_type IN ('Individual') )  )  AND  ( 1 )' at line 1]
    [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name  FROM civicrm_contact contact_a WHERE  (  ( contact_a.is_deceased !=  AND contact_a.contact_type IN ('Individual') )  )  AND  ( 1 )     [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 'AND contact_a.contact_type IN ('Individual') )  )  AND  ( 1 )' at line 1]"]

Yashodha Chaku

  • Forum Godess / God
  • Ask me questions
  • *****
  • Posts: 755
  • Karma: 57
    • CiviCRM
Re: Errors when using search builder and !=
June 10, 2009, 10:14:48 pm
Sarah :

Can you file an issue with JIRA.

-Yashodha
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

Yashodha Chaku

  • Forum Godess / God
  • Ask me questions
  • *****
  • Posts: 755
  • Karma: 57
    • CiviCRM
Re: Errors when using search builder and !=
June 11, 2009, 01:04:36 am
Sarah :

This has been fixed for 2.3
You can check the patch here: http://fisheye.civicrm.org/changelog/CiviCRM?cs=21730

HTH
-Yashodha
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

TallDavid

  • I post occasionally
  • **
  • Posts: 41
  • Karma: 2
    • ATO Zeta Mu Alumni
  • CiviCRM version: 3.4.8
  • CMS version: Drupal 6.22
  • MySQL version: 5.1.52
  • PHP version: 5.2.13
Re: Errors when using search builder and !=
August 12, 2010, 05:52:10 am
It looks like this error has returned from the dead in 3.2.0.  On a production installation, once working Smart Group queries are now failing and recreating the query also gives errors.

On drupal.demo.civicrm.org/civicrm/contact/search/builder I've been able to reproduce the error:

Sorry. A non-recoverable error has occurred.
DB Error: syntax error
Error Details
Code: [Select]
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 ''' ) AND contact_a.is_deceased != 1 AND contact_a.do_not_email != 1 AND contact_' at line 1, 1064
Additional Details:

Array
(
    [callback] => Array
        (
            [0] => CRM_Core_Error
            [1] => handle
        )

    [code] => -2
    [message] => DB Error: syntax error
    [mode] => 16
    [debug_info] => SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name  FROM civicrm_contact contact_a LEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_email.is_primary = 1)  WHERE  (  (  ( civicrm_email.email IS NOT NULL '' ) AND contact_a.is_deceased != 1 AND contact_a.do_not_email != 1 AND contact_a.contact_type IN ('Individual') )  )  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 ''' ) AND contact_a.is_deceased != 1 AND contact_a.do_not_email != 1 AND contact_' at line 1]
    [type] => DB_Error
    [user_info] => SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name  FROM civicrm_contact contact_a LEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_email.is_primary = 1)  WHERE  (  (  ( civicrm_email.email IS NOT NULL '' ) AND contact_a.is_deceased != 1 AND contact_a.do_not_email != 1 AND contact_a.contact_type IN ('Individual') )  )  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 ''' ) AND contact_a.is_deceased != 1 AND contact_a.do_not_email != 1 AND contact_' at line 1]
    [to_string] => [db_error: message="DB Error: syntax error" code=-2 mode=callback callback=CRM_Core_Error::handle prefix="" info="SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name  FROM civicrm_contact contact_a LEFT JOIN civicrm_email ON (contact_a.id = civicrm_email.contact_id AND civicrm_email.is_primary = 1)  WHERE  (  (  ( civicrm_email.email IS NOT NULL '' ) AND contact_a.is_deceased != 1 AND contact_a.do_not_email != 1 AND contact_a.contact_type IN ('Individual') )  )  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 ''' ) AND contact_a.is_deceased != 1 AND contact_a.do_not_email != 1 AND contact_' at line 1]"]
)

Basically, I'm trying to build a query for individuals where the email address exists, the individual is not deceased and the individual is not flagged DO NOT EMAIL.  Workarounds?  Shall we re-open the JIRA ticket?
[/code]

Yashodha Chaku

  • Forum Godess / God
  • Ask me questions
  • *****
  • Posts: 755
  • Karma: 57
    • CiviCRM
Re: Errors when using search builder and !=
August 12, 2010, 06:31:51 am
TallDavid :

Can you file an issue for the same in JIRA (http://issues.civicrm.org/) for 3.2.2

-Yashodha
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Errors when using search builder and !=

This forum was archived on 2017-11-26.