0

GUIにデータグリッドがあり、現在次のSQLが入力されているac#アプリケーションがあります

      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
4

0 に答える 0