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
cursor position in textbox
Reporting Services dynamic columns
Get value from a specific field based on the value of an another field in the same query?
Fan races computer will not Boot
how to stop a stored procedure
Randam generatetion in asp.net with C#
Referencing a hidden sheet in excel using a hyperlink
Best way to package upgrades in Access
Is there a way to convert a printdocument to a bitmap?
missing files after chkdsk!!!!!!!!!!!!