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 »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Advanced search error on groups
Pages: [1]

Author Topic: Advanced search error on groups  (Read 1734 times)

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Advanced search error on groups
March 26, 2008, 07:19:43 am
Hello,

I am using the latest 2.0.1 stable. When I do an advanced search on any of my groups, I am getting this error:

Code: [Select]
unrecoverable error
    Sorry. A non-recoverable error has occurred.

    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 ') = 'all' ) AND ( 1 ) AND 1 ) AND contact_' at line 2, 1064

    Return to home page.

Error 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_group_contact `civicrm_group_contact-2` ON contact_a.id = `civicrm_group_contact-2`.contact_id   WHERE  ( ( ( `civicrm_group_contact-2`.group_id IN (2) AND `civicrm_group_contact-2`.status IN ("Added") ) OR ( 
                            ( contact_a.id IN ( SELECT DISTINCT(contact_a.id) as id  FROM civicrm_contact contact_a LEFT JOIN civicrm_contribution ON civicrm_contribution.contact_id = contact_a.id   LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-6,7,9,8,10,11` ON ( `civicrm_entity_tag-6,7,9,8,10,11`.contact_id = contact_a.id )   WHERE  ( `civicrm_entity_tag-6,7,9,8,10,11`.tag_id IN (6,7,9,8,10,11) AND LOWER(  ) = 'all' )  AND  ( 1 )  AND 1    ) 
                              AND contact_a.id NOT IN (
                              SELECT contact_id FROM civicrm_group_contact
                              WHERE civicrm_group_contact.group_id = 2 AND civicrm_group_contact.status = 'Removed' ) ) ) ) )  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 ') = 'all' )  AND  ( 1 )  AND 1    ) 
                              AND contact_' at line 2]
    [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_group_contact `civicrm_group_contact-2` ON contact_a.id = `civicrm_group_contact-2`.contact_id   WHERE  ( ( ( `civicrm_group_contact-2`.group_id IN (2) AND `civicrm_group_contact-2`.status IN ("Added") ) OR ( 
                            ( contact_a.id IN ( SELECT DISTINCT(contact_a.id) as id  FROM civicrm_contact contact_a LEFT JOIN civicrm_contribution ON civicrm_contribution.contact_id = contact_a.id   LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-6,7,9,8,10,11` ON ( `civicrm_entity_tag-6,7,9,8,10,11`.contact_id = contact_a.id )   WHERE  ( `civicrm_entity_tag-6,7,9,8,10,11`.tag_id IN (6,7,9,8,10,11) AND LOWER(  ) = 'all' )  AND  ( 1 )  AND 1    ) 
                              AND contact_a.id NOT IN (
                              SELECT contact_id FROM civicrm_group_contact
                              WHERE civicrm_group_contact.group_id = 2 AND civicrm_group_contact.status = 'Removed' ) ) ) ) )  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 ') = 'all' )  AND  ( 1 )  AND 1    ) 
                              AND contact_' at line 2]
    [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_group_contact `civicrm_group_contact-2` ON contact_a.id = `civicrm_group_contact-2`.contact_id   WHERE  ( ( ( `civicrm_group_contact-2`.group_id IN (2) AND `civicrm_group_contact-2`.status IN ("Added") ) OR ( 
                            ( contact_a.id IN ( SELECT DISTINCT(contact_a.id) as id  FROM civicrm_contact contact_a LEFT JOIN civicrm_contribution ON civicrm_contribution.contact_id = contact_a.id   LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-6,7,9,8,10,11` ON ( `civicrm_entity_tag-6,7,9,8,10,11`.contact_id = contact_a.id )   WHERE  ( `civicrm_entity_tag-6,7,9,8,10,11`.tag_id IN (6,7,9,8,10,11) AND LOWER(  ) = 'all' )  AND  ( 1 )  AND 1    ) 
                              AND contact_a.id NOT IN (
                              SELECT contact_id FROM civicrm_group_contact
                              WHERE civicrm_group_contact.group_id = 2 AND civicrm_group_contact.status = 'Removed' ) ) ) ) )  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 ') = 'all' )  AND  ( 1 )  AND 1    ) 
                              AND contact_' at line 2]"]
)

However, I couldn't recreate this error on the demo. I don't know why I am getting it. Any suggestions?
[/code]

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Advanced search error on groups
March 26, 2008, 11:11:06 am

hey emily:

1. what search are you trying to do. i see an OR clause with contribution and tags in the below sql which seems to cause the error

2. are you using acl's?

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

emilyf

  • Ask me questions
  • ****
  • Posts: 696
  • Karma: 54
  • CiviCRM version: 2.x - 4.x
  • CMS version: Drupal 5, 6, 7
Re: Advanced search error on groups
March 27, 2008, 06:54:20 am
lobo,

Quote
1. what search are you trying to do. i see an OR clause with contribution and tags in the below sql which seems to cause the error
I am doing an advanced search on a single group, no other parameters. After a bit more testing, I realized that this error is thrown when I search on a Smart Group, but when I search on a non-Smart Group, it returns results properly.

Note: I get the same error if I go to "Manage Groups" and then click on the "Members" link for any Smart Group. My Smart Groups range in terms of their parameters, but all of them are created based on specific tags that contacts have. So if a contact has tags A and B, then they are in Smart Group 1, and so on. However, none of my Smart Groups have anything to do with contributions as far as I can tell.

Quote
2. are you using acl's?

I had 2 acl's that I had been testing with, but they were not important. I deleted them, but the error still exists when I search on a Smart Group.

I do know that these searches worked in 1.9, so I am thinking it must have something to do with the 2.0 upgrade....?

thanks,
emily

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Advanced search error on groups
March 27, 2008, 10:03:41 am

can u email me the database to my gmail address

thanx

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

neuromusic

  • Guest
Re: Advanced search error on groups
January 26, 2009, 04:50:31 am
Was this resolved? I am having what I think is the same issue.

-Justin

neuromusic

  • Guest
Re: Advanced search error on groups
January 26, 2009, 04:58:12 am
Nevermind. I found the resolution:

http://forum.civicrm.org/index.php/topic,3000.0.html


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Post-installation Setup and Configuration (Moderator: Dave Greenberg) »
  • Advanced search error on groups

This forum was archived on 2017-11-26.