Query Error -- Report to System Administrator ASAP


MySQL Query Failed: Expression #2 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'opencats2.attachment.attachment_id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

SELECT
                joborder.joborder_id AS jobOrderID,
                IF(attachment_id, 1, 0) AS attachmentPresent,
                joborder.title AS title,
                joborder.description AS jobDescription,
                joborder.type AS type,
                joborder.is_hot AS isHot,
                joborder.openings AS openings,
                joborder.openings_available AS openingsAvailable,
                joborder.duration AS duration,
                joborder.city AS city,
                joborder.state AS state,
                joborder.status AS status,
                joborder.company_department_id AS departmentID,
                joborder.questionnaire_id as questionnaireID,
                company.company_id AS companyID,
                company.name AS companyName,
                company_department.name AS departmentName,
                contact.contact_id AS contactID,
                recruiter_user.first_name AS recruiterFirstName,
                recruiter_user.last_name AS recruiterLastName,
                owner_user.first_name AS ownerFirstName,
                owner_user.last_name AS ownerLastName,
                DATE_FORMAT(DATE_SUB(
                    joborder.start_date, INTERVAL 1 HOUR), '%m-%d-%y'
                ) AS startDate,
                DATE_FORMAT(DATE_SUB(
                    joborder.date_created, INTERVAL 1 HOUR), '%m-%d-%y'
                ) AS dateCreated,
                DATE_FORMAT(DATE_SUB(
                    joborder.date_modified, INTERVAL 1 HOUR), '%m-%d-%y'
                ) AS dateModified,
                DATEDIFF(
                    NOW(), joborder.date_created
                ) AS daysOld,
                COUNT(
                    candidate_joborder.joborder_id
                ) AS pipeline,
                (
                    SELECT
                        COUNT(*)
                    FROM
                        candidate_joborder_status_history
                    WHERE
                        joborder_id = joborder.joborder_id
                    AND
                        status_to = 400
                    AND
                        site_id = 1
                ) AS submitted,
                joborder.is_admin_hidden AS isAdminHidden,
                joborder.date_created AS dateCreatedSort
            FROM
                joborder
            LEFT JOIN company
                ON joborder.company_id = company.company_id
            LEFT JOIN contact
                ON joborder.contact_id = contact.contact_id
            LEFT JOIN company_department
                ON joborder.company_department_id = company_department.company_department_id
            LEFT JOIN candidate_joborder
                ON joborder.joborder_id = candidate_joborder.joborder_id
            LEFT JOIN user AS recruiter_user
                ON joborder.recruiter = recruiter_user.user_id
            LEFT JOIN user AS owner_user
                ON joborder.owner = owner_user.user_id
            LEFT JOIN attachment
                ON
                (
                    joborder.joborder_id = attachment.data_item_id
                    AND attachment.data_item_type = 400
                )
            WHERE
                joborder.site_id = 1
            AND joborder.status = 'Active'
            
            
            
            
            AND joborder.public = 1
            AND joborder.is_admin_hidden = 0
            GROUP BY
                joborder.joborder_id
            ORDER BY
                daysOld ASC,
                dateCreatedSort DESC