SQL – An aggregate may not appear in the set list of an UPDATE statement
I have a Project table that contains a couple of fields used for reporting and metrics called FirstActivity, LastActivity, and TotalHours. I created the following SQL query to update those fields based on some aggregated results from the ProjectHours table: UPDATE [dbo].[Project] SET FirstActivity = MIN(ProjectHours.[EntryDate]) , FirstActivity = MAX(ProjectHours.[EntryDate]) , TotalHours = SUM(ProjectHours.[TotalHours]) FROM…