OpenCATS icon indicating copy to clipboard operation
OpenCATS copied to clipboard

Filtering contacts by department gives MySQL error

Open RussH opened this issue 8 years ago • 0 comments

the below error is reported in Contacts when trying to filter by Department

`MySQL Query Failed: Unknown column 'company_department.department' in 'where clause'

SELECT SQL_CALC_FOUND_ROWS contact.is_hot AS isHot, contact.contact_id AS contactID, contact.contact_id AS exportID, contact.date_modified AS dateModifiedSort, contact.date_created AS dateCreatedSort, owner_user.first_name AS ownerFirstName, owner_user.last_name AS ownerLastName, CONCAT(owner_user.last_name, owner_user.first_name) AS ownerSort, contact.first_name AS firstName, contact.last_name AS lastName, company.name AS name,company.company_id as companyID, contact.title AS title, contact.phone_work AS workPhone, DATE_FORMAT(contact.date_created, '%d-%m-%y') AS dateCreated, DATE_FORMAT(contact.date_modified, '%d-%m-%y') AS dateModified, company_department.company_department_id AS companyDepartmentID, company_department.name as department FROM contact LEFT JOIN company ON contact.company_id = company.company_id LEFT JOIN user AS owner_user ON contact.owner = owner_user.user_id LEFT JOIN company_department on company_department.company_department_id = contact.company_department_id LEFT JOIN saved_list_entry ON saved_list_entry.data_item_type = 300 AND saved_list_entry.data_item_id = contact.contact_id AND saved_list_entry.site_id = 1 WHERE contact.site_id = 1 AND (company_department.department = 'HR' )

        GROUP BY contact.contact_id
        
        ORDER BY department DESC
        LIMIT 0, 15`

RussH avatar Jun 20 '17 11:06 RussH