Skip to main content
Bounty Ended with 50 reputation awarded by Nina Gonzalez
added 133 characters in body
Source Link
Chris Burgess
  • 9.9k
  • 15
  • 45

It seems you have some entries remaining in civicrm_group_contact which point to the deleted civicrm_group entry?

You can confirm this with a query to look for group contact entries which point to a missing group.

-- Show contacts who belong to a group that doesn't exist.
SELECT * 
  FROM civicrm_group_contact 
 WHERE group_id NOT IN (SELECT id FROM civicrm_group);

If entries are found with that query, you can clear them out (or update them to point to the new group, or export those contact IDs, or ...).

-- Standard disclaimers apply; back up your DB before doing this!
DELETE  
  FROM civicrm_group_contact 
 WHERE group_id NOT IN (SELECT id FROM civicrm_group);

If updating, you'll want to avoid creating duplicate entries by reassigning group_id without checking for existing group additions.

It seems you have some entries remaining in civicrm_group_contact which point to the deleted civicrm_group entry?

You can confirm this with a query to look for group contact entries which point to a missing group.

-- Show contacts who belong to a group that doesn't exist.
SELECT * 
  FROM civicrm_group_contact 
 WHERE group_id NOT IN (SELECT id FROM civicrm_group);

If entries are found with that query, you can clear them out (or update them to point to the new group, or export those contact IDs, or ...).

-- Standard disclaimers apply; back up your DB before doing this!
DELETE  
  FROM civicrm_group_contact 
 WHERE group_id NOT IN (SELECT id FROM civicrm_group);

It seems you have some entries remaining in civicrm_group_contact which point to the deleted civicrm_group entry?

You can confirm this with a query to look for group contact entries which point to a missing group.

-- Show contacts who belong to a group that doesn't exist.
SELECT * 
  FROM civicrm_group_contact 
 WHERE group_id NOT IN (SELECT id FROM civicrm_group);

If entries are found with that query, you can clear them out (or update them to point to the new group, or export those contact IDs, or ...).

-- Standard disclaimers apply; back up your DB before doing this!
DELETE  
  FROM civicrm_group_contact 
 WHERE group_id NOT IN (SELECT id FROM civicrm_group);

If updating, you'll want to avoid creating duplicate entries by reassigning group_id without checking for existing group additions.

Source Link
Chris Burgess
  • 9.9k
  • 15
  • 45

It seems you have some entries remaining in civicrm_group_contact which point to the deleted civicrm_group entry?

You can confirm this with a query to look for group contact entries which point to a missing group.

-- Show contacts who belong to a group that doesn't exist.
SELECT * 
  FROM civicrm_group_contact 
 WHERE group_id NOT IN (SELECT id FROM civicrm_group);

If entries are found with that query, you can clear them out (or update them to point to the new group, or export those contact IDs, or ...).

-- Standard disclaimers apply; back up your DB before doing this!
DELETE  
  FROM civicrm_group_contact 
 WHERE group_id NOT IN (SELECT id FROM civicrm_group);