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
Unable to open <a rel="nofollow" href="http://" target="_blank">http://</a>.... Cannot download the information you requested
How do I restore a .cmp file to a Top Level Site?
iPhone 3G and SBS 2003/Exchange Activesync
Bring back deleted mail
Disabling Tintsetp.exe, ImScInst.exe, IMJPMIG.exe
BOOT.INI for Win98 on partition 2
creating a complicated report in access
Set size and position of a form
Trigger on Table?
Writing a File To a CD from Access?