0
按星期查询的我的SQL组如下所示,但是在那里出现跟随错误。按星期查询获取错误组
列'timesheet.timeheet_date'在选择列表中无效,因为它不包含在聚合函数或GROUP BY子句中。
任何人可以帮助我在这方面
我的查询:
select
DatePart(week, timesheet_date),
count(timesheet.timesheet_id) as TimeSheetID,
timesheet.timesheet_date,
timesheet.start_time,
timesheet.end_time,
timesheet.timesheet_status_id,
timesheet.is_deleted,
timesheet.created_by,
timesheet.modified_by,
timesheet.created_date,
task.name,
project.name,
[user].first_name, [user].last_name
from
timesheet, task, project, [user]
where
task_id = (select task_id from project_task
where project_task_id = timesheet.project_task_id)
and project_id = (select project_id from project_task
where project_task_id = timesheet.project_task_id)
and [user].user_id = timesheet.user_id
and timesheet.user_id = 30
group by
timesheet.timesheet_id
是否使用的是RDBMS? –
你有没有试过找出错误信息试图告诉你什么?这是一个非常明确的信息。 – Tomalak
@astander这就是SQL Server。 – Tomalak