错误:
#1055 - SELECT列表的表达式#1不在GROUP BY子句中,并且包含非聚合列
不兼容'timesheet.timesheet_client.organisation'
,它在功能上不依赖于GROUP BY子句中的列;这与sql_mode=only_full_group_by
我有以下查询并在执行时遇到错误。
查询:
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