update Publisher
set Publisher.[Count]=Count(Document.Id)
From Publisher inner join Document
on Publisher.Name=Document.Organization COLLATE DATABASE_DEFAULT
答案 0 :(得分:1)
假设SQL Server,您希望通过将group by Publisher.Name
放在查询末尾来解决此问题。但是,更新语句中不允许这样做。因此,您必须使用相关的子选择:
update
p
set
p.[Count] = (
Select Count(*)
From Document d
Where p.[Name] = d.Organization collate database_default
)
From
Publisher p;