select distinct
assignedTo,
alert_id,
insert_date_time,
alert_status_id,
alert_action_id,
alert_call_reason_id,
target_date
from Case_Management.AlertDetail
工作正常。(看似)简单查询的SQL错误
select distinct
assignedTo,
alert_id,
max(insert_date_time),
alert_status_id,
alert_action_id,
alert_call_reason_id,
target_date
from Case_Management.AlertDetail
返回,因为它不是在聚合函数或GROUP BY子句中包含的错误列“Case_Management.AlertDetail.assignedTo”在选择列表中无效。
我很难过。
对于其余字段,您正在使用不带“GROUP BY”的聚合函数('MAX')。 – LittleBobbyTables 2013-03-19 19:41:54