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
Restore a Sharepoint Site from an SQL Database Backup
Is there a way to access the Office clipboard using Visual Basic in Word?
C# 3.0 - Generic Bulk Copy
How to format SQL query string in vb.net for a multi-field index in Access??
How can I automatically (VBA) insert a comment when certain condition exist in a cell;
Open and Print PDF file
On timer event passes it's own time
Office 2007 Product ID
protecting decompiling of ocx in browser
How do I get a DataGridView to refresh after I modify the DataSource?