I am struggling a little bit with my query (actually a view), which contains a GROUP BY clause to eliminate some duplication and perform some aggregate functions.My basic query is like this:SELECT pid.Value AS MapVersion, pi.Folio AS ArticleTitle, a.[Name] AS ActivityName, pid2.Value AS ArticleType, MIN(ai.StartDate) AS StartDate, MAX(ai.FinishDate) AS FinishDate, pi.ID AS ProcessId, aid.[User] AS ContributorFROM _ProcInst pi INNER JOIN _ProcInstData pid ON pid.ProcInstID = pi.ID AND pid.Name = 'MapVersion' INNER JOIN _ProcInstData pid2 ON pid2.ProcInstID = pi.ID AND pid2.Name = 'ArticleType' INNER JOIN _Proc p ON pi.ProcID = p.ID INNER JOIN _ProcSet ps ON p.ProcSetID = ps.ID INNER JOIN _ActInst ai ON ai.ProcInstID = pi.ID INNER JOIN _Act a ON ai.ActID = a.ID INNER JOIN _ActInstDest aid ON aid.ActInstID = ai.ID AND aid.ProcInstId = pi.IDGROUP BY pid.Value, pid2.Value, pi.Folio, a.[Name], pi.ID, aid.[User]
(not my table names/schema, by the way)This works fine. However, I do not want to Group By aid.User anymore. Instead, I want to get the aid.User value that corresponds to the MAX(ai.FinishDate).In general terms, how can I get a piece of data from the row that my aggregate function is fetching?Thanks!