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) »
  • Simple SEARCH BUILD query = This Group but Not that Group
Pages: [1]

Author Topic: Simple SEARCH BUILD query = This Group but Not that Group  (Read 1279 times)

petednz

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4899
  • Karma: 193
    • Fuzion
  • CiviCRM version: 3.x - 4.x
  • CMS version: Drupal 6 and 7
Simple SEARCH BUILD query = This Group but Not that Group
March 11, 2008, 12:12:35 am
If I want to find people who are in one group (groupID=42) and not in another(groupID=44) can I presume that the following will work
Indiv >> Group >> = 42
Indiv >> Group >> != 44

I am expecting the answer to be yes, at which point I would say .... but it didn't work.
# in 42 is 531
# in 44 is 299
# returned for 42 NOT 44 is 139 and definitely includes people who are on both lists.

Any pointers?
Sign up to StackExchange and get free expert advice: https://civicrm.org/blogs/colemanw/get-exclusive-access-free-expert-help

pete davis : www.fuzion.co.nz : connect + campaign + communicate

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: Simple SEARCH BUILD query = This Group but Not that Group
March 12, 2008, 01:38:00 pm

can u get chris to check the generated sql and see what the problem is

i think the issue might be that sql semantics != set semantics for our data model

A person is in a group if there is a group_contact record with a status of Added for that group
A person is NOT in a group if there is no group_contact record OR there is a group_contact record with the status NOT Added for that group

The NOT case is a bit more tricky since it involves an OR clause and i suspect the sql we generate does not account for it

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Core CiviCRM Functions (Moderator: Yashodha Chaku) »
  • Simple SEARCH BUILD query = This Group but Not that Group

This forum was archived on 2017-11-26.