我的 SELECT MAX(DATE) 代码有问题;当我运行我的查询时,我得到了 3000+ 行,但是我得到了 [AssigneeID] 的重复行,而不仅仅是具有 MAX(DATE) 的行?请在运行查询后查看我的代码和表格示例。
SELECT DISTINCT
i.[RecID] as AssigneeID,
t.[CreatedDateTime]
FROM Incident as i
Left Join Task as t
On i.[RecID] = t.[ParentLink_RecID]
WHERE
(t.[CreatedDateTime] IN (SELECT MAX(t.[CreatedDateTime])
FROM Task as t
GROUP BY t.[ParentLink_RecID]))
AND i.[Status] <> 'Closed'
AND t.[OwnerTeam] IS NOT NULL
Order By i.[RecID] DESC
AssigneeID CreatedDateTime
E94D6F547A73430BA75758C79D5BD8DB 28/05/2013 10:25
E94D6F547A73430BA75758C79D5BD8DB 28/05/2013 10:32
CB208EB6BCC24E1791F946F01D6AF97B 26/03/2013 15:14
CB208EB6BCC24E1791F946F01D6AF97B 16/05/2013 15:20
BE14926E300E45AD8A9A949114CE8026 29/04/2013 10:27
BE14926E300E45AD8A9A949114CE8026 01/05/2013 08:41
提前感谢您的任何指导