我让我的 SQL 代码返回 Max t.[CreatedDateTime] (见下文)给我正确的结果,但是我希望添加一个额外的列 t.[Owner] 并且不在结果中显示 [CreatedDateTime] 但仍然基于Max([t.CreatedDateTime]) 上的结果
SELECT i.[RecID] as AssigneeID, max(t.[CreatedDateTime]) CreatedDateTime
FROM Incident as i
Join Task as t On i.[RecID] = t.[ParentLink_RecID]
WHERE i.[Status] <> 'Closed'
AND t.[OwnerTeam] IS NOT NULL
group by i.[RecID]
Order By i.[RecID] DESC
当前结果
AssigneeID CreatedDateTime
FFFE53B2305D47388937D1F5B6722DF3 2013-05-13 14:36:55.000
FFD64AD977A449258A88B9A404795631 2013-05-21 14:11:28.000
FFD557F622A34FD1A386B427B66ADAFC 2013-04-26 12:32:05.000
所需结果
AssigneeID Owner
FFFE53B2305D47388937D1F5B6722DF3 Bob
FFD64AD977A449258A88B9A404795631 Fred
FFD557F622A34FD1A386B427B66ADAFC Harry
提前感谢您的任何帮助..