通过导致datagrid失败进行分组

时间:2013-08-16 14:20:27

标签: c# sql datagrid

我有一个c#应用程序,其GUI有datagrid,目前正在使用以下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

但是这样做会导致数据网格空...有谁知道为什么这是/一个变通方法?

在“查询”构建器中运行“分组”会显示此错误消息

      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

0 个答案:

没有答案