Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filtering contacts by department gives MySQL error #282

Open
RussH opened this issue Jun 20, 2017 · 0 comments
Open

Filtering contacts by department gives MySQL error #282

RussH opened this issue Jun 20, 2017 · 0 comments

Comments

@RussH
Copy link
Member

RussH commented Jun 20, 2017

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 RussH changed the title Filtering by companies by department gives MySQL error Filtering contacts by department gives MySQL error Jun 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant