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 (Moderator: Dave Greenberg) »
  • Cannot view criteria or contacts in a smart group
Pages: [1]

Author Topic: Cannot view criteria or contacts in a smart group  (Read 644 times)

rchapman

  • I post occasionally
  • **
  • Posts: 77
  • Karma: 0
Cannot view criteria or contacts in a smart group
September 15, 2010, 05:36:45 am
Morning,

  we're getting a weird error when we try to view some of our smart groups. Some smart groups we can view, but others we get the error "Database Error Code: Operand should contain 1 column(s), 1241"

 Same error when I try to run the query from the sql prompt. Here is the command:

SELECT DISTINCT UPPER(LEFT(contact_a.sort_name, 1)) as sort_name FROM civicrm_contact contact_a  LEFT JOIN civicrm_entity_tag `civicrm_entity_tag-7,9` ON ( `civicrm_entity_tag-7,9`.entity_id = contact_a.id AND `civicrm_entity_tag-7,9`.entity_table = 'civicrm_contact' )    LEFT JOIN civicrm_group_contact `civicrm_group_contact-2` ON contact_a.id = `civicrm_group_contact-2`.contact_id WHERE  ( contact_a.contact_type IN ('Individual') AND `civicrm_group_contact-2`.group_id IN ( 2 ) AND `civicrm_group_contact-2`.status IN ("Added") AND `civicrm_entity_tag-7,9`.tag_id = (7,9) )  AND (contact_a.is_deleted = 0)  GROUP BY contact_a.id;

Is this perhaps something we've overlooked setting up the mysql server? Or is it that our smart group wasn't created with the correct data/contacts? Has anyone come across this before or could shed some light for us?

thanks,

~r

Dave Greenberg

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 5760
  • Karma: 226
    • My CiviCRM Blog
Re: Cannot view criteria or contacts in a smart group
September 15, 2010, 10:05:45 am
Looks to me like a bug in the way the smart group query is being assembled. There's a syntax problem in the clause below:

Code: [Select]
AND `civicrm_entity_tag-7,9`.tag_id = (7,9)
the '=' operand needs to 'IN' since it's a list of values (7,9)

Please set up a similar smart group case on the 3.2.3 public demo and see if the error is reproducible in the latest codebase. If so, please file an issue in the issue tracker w/ exact steps to replicate AND a patch if you have resources to investigate the fix.
Protect your investment in CiviCRM by  becoming a Member!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • Cannot view criteria or contacts in a smart group

This forum was archived on 2017-11-26.