Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Minor
-
Resolution: Fixed/Completed
-
Affects Version/s: 4.6.5
-
Fix Version/s: 4.6.6
-
Component/s: Core CiviCRM
-
Labels:None
-
Documentation Required?:None
-
Funding Source:Core Team Funds
Description
This is a bit of a corner case. This is reproduced in http://d46.demo.civicrm.org.
Go to Contacts => Manage Groups
Click on Update Smart Group Counts (left side below the Find Groups box)
It will error with a syntax error. It errors on the smart group LYBUNT.
This smart group was created with Search => Custom Searches => Contributions made in Year X and not Year Y.
I'm not sure how to get the sql error from demo but from my system here is the sql. The first AND should be a WHERE.
CREATE TEMPORARY TABLE civicrm_temp_group_contact_cache886 (SELECT 65 as group_id, contact_a.id as contact_id FROM CustomSearch_SYBNT_temp as contact_a AND contact_a.id NOT IN ( SELECT contact_id FROM civicrm_group_contact WHERE civicrm_group_contact.status = 'Removed' AND civicrm_group_contact.group_id = 65 ) );