我有 ac# 应用程序,其 GUI 具有数据网格,目前正在使用以下 sql 填充
UPDATE mi
SET mi.ClientName = c.ClientName
FROM generic.MasterInventory mi INNER JOIN
generic.Client c ON mi.FK_Client = c.PK_Client
SELECT DISTINCT
ClientName, FundName, PK_MasterInventory, FK_Fund, FK_Client, ISIN, Status, ShareCurrency, PriceFrequency, ClassCode, Simulation, Hedged,
FundCurrency, [Type] FROM generic.MasterInventory
但是我无法删除重复的记录。我试过使用 groupby
UPDATE mi
SET mi.ClientName = c.ClientName
FROM generic.MasterInventory mi INNER JOIN
generic.Client c ON mi.FK_Client = c.PK_Client
SELECT DISTINCT
ClientName, FundName, PK_MasterInventory, FK_Fund, FK_Client, ISIN, Status, ShareCurrency, PriceFrequency, ClassCode, Simulation, Hedged,
FundCurrency, [Type] FROM generic.MasterInventory
GROUP BY ClientName
然而,这样做会导致一个空的数据网格......有谁知道为什么这是/一种解决方法?
在查询生成器中运行 Group by 会给出此错误消息
Column generic.masterInventory.FundName is invalid
in the select list because it is not contained in
either an aggregate function or the group by clause