0

Error:

#1055 - Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'timesheet.timesheet_client.organisation' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by

I have the following query and getting error when executing.

Query:

SELECT timesheet_client.organisation                                 AS client_name,
    timesheet_project.title                                          AS project_name,
    timesheet_task.name                                              AS task,
    CONCAT(timesheet_user.first_name, ' ', timesheet_user.last_name) AS resource_name,
    timesheet_user.bill_factor,
    timesheet_client.client_type,
    sec_to_time(SUM(unix_timestamp(end_time) - unix_timestamp(start_time))) AS spent,
    SUM(unix_timestamp(end_time)             - unix_timestamp(start_time))  AS diff,
    date_format(start_time, '%Y/%m/%d')                                     AS start_date,
    trans_num,
    timesheet_user.grp_id,
    timesheet_client.client_id,
    timesheet_times.proj_id,
    timesheet_times. task_id,
    timesheet_times.uid,
    timesheet_times.delete_flag,
    timesheet_user_grp.grp_name
FROM timesheet_user
JOIN timesheet_times
ON  timesheet_user.username=timesheet_times.uid
JOIN timesheet_project
ON  timesheet_project.proj_id=timesheet_times.proj_id
JOIN timesheet_client
ON  timesheet_client.client_id=timesheet_project.client_id
JOIN timesheet_task
ON  timesheet_task.task_id = timesheet_times.task_id
JOIN timesheet_user_grp
ON  timesheet_user.grp_id    =timesheet_user_grp.grp_id
WHERE timesheet_task.task_id!=''
AND timesheet_user.grp_id   IN (0,1)
AND end_time                 > 0
AND start_time              >= '2017-06-01'
AND end_time                <= '2017-06-31 23:59:59'
AND delete_flag              ='NO'
GROUP BY task_id,
    uid
ORDER BY client_type DESC,
    organisation,
    proj_id,
    task_id,
    uid 
Antti29
  • 2,953
  • 12
  • 34
  • 36

0 Answers0