The application is hosted in Bluehost in a Shared hosting. I tried executing the below query in phpMyAdmin and the results works fine:
SELECT employee_id , floor(Datediff(max(to_date), min(from_date))/365) As diif FROM `work_experiences` group by employee_id having floor(Datediff(max(to_date), min(from_date))/365) >=15
Below is my Laravel Query builder:
$query->groupBy('employee_id');
$query->havingRaw('Floor(Datediff(Max(to_date), min(from_date))/365) >='.$filterOverralExperienceA);
$query->havingRaw('Floor(Datediff(Max(to_date), min(from_date))/365) <='. $filterOverralExperienceB);
The above code gives me the blow error:
Syntax error or access violation: 1055 Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'affixpro_jobhut.work_experiences.id' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by (SQL: select count(*) as aggregate from
userswhereis_active= 1 and exists (select * fromuser_typeswhereusers.id=user_types.user_idandis_type_active= 1 andis_active= 1) and exists (select * fromemployeeswhereusers.id=employees.user_idandis_edited_first_time= 1 and exists (select * fromwork_experienceswhereemployees.id=work_experiences.employee_idgroup byemployee_idhaving Floor(Datediff(Max(to_date), min(from_date))/365) >=10 and Floor(Datediff(Max(to_date), min(from_date))/365) <=100)))
Group by ID works fine but not employee_id.
I have already tried changing the database config strict to false but still this continues.
Appreciate your help and assistance in this.