Details
Description
Go to "view contact" who has case(s). Click Cases tab:
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 'DISTINCT ( civicrm_case.id ) IN ( 1 ) GROUP BY civicrm_case.id'
Note that there's two instances of DISTINCT in the current query:
"SELECT DISTINCT ( civicrm_case.id )..." at the beginning and at the end in the WHERE clause
"WHERE ( contact_a.id = 105 AND civicrm_case.is_deleted = 0 ) AND (contact_a.is_deleted = 0) AND DISTINCT ( civicrm_case.id ) IN ( 1 ) GROUP BY civicrm_case.id"
Removing line 175 from CRM/Case/Selector/Search.php resolves the error - but not sure that's the right fix:
$this->_query->_distinctComponentClause = " DISTINCT ( civicrm_case.id )";