Microsoft
Software
Hardware
Network
Question : aggregate in the set list of an UPDATE statement.
Hello, I get the following error with my statement below:
An aggregate may not appear in the set list of an UPDATE statement.
How can I fix the statement?
Update a
set LastComment = MAX(b.created)
from ReviewComments b
INNER JOIN #Temp a
ON a.[ReviewId] = b.[ReviewId]
Answer : aggregate in the set list of an UPDATE statement.
This should do:
Update a
set LastComment = b.created
from #Temp a
INNER JOIN ( SELECT [ReviewId], MAX(created) created FROM ReviewComments
GROUP BY [ReviewId]) b
ON a.[ReviewId] = b.[ReviewId]
Random Solutions
Working Days Calculator
how to get move line through mouse drag in view?
outlook 2003 attach item problem (attach as email)
Caluculate if met SLA for completetion of task- Problem
Access 2007 links to SQL Server 2000 tables not updateable
Excel chart
Unable to log a Guid Type into SQL Using log4net AdoNetAppender
sharing open ports in c#
Testing Outlook Anywhere
How do I fix Microsoft Exchange 2007 "Active Directory server <myserver> is not available" error on Windows Server 2003?