複数の列でグループを選択する方法

以下のSQLを使用する前に、この小さなトリックを知りませんでした

図1は、(結果に影響を与える)ことにより、後でクエリ列のグループに追加され

 

重合最大として機能します

選択 a.accounttitlecodeを、最大(b.currency)、マックス(a.isqty)
   からbfacctitleaccrlat2019、 選択し た場合を
                 場合 T.IsCrcy =  1  次に
                  T.crcy 
                 そう
                  ' maincurrency ' 
               末端通貨、
               T.Accounttitlecode、
               T.Ledger 
          からbfacctitleaccrlat2019 T
          ここ T.Chartofaccount =  ' f80ff706-4f66-45ba-bb0f-639f46712316 ' 
            T.Ledger =  '4272a6b9-451a-44b0-954f-48944c31baca ' 
            T.Accounttitlecode など ' 1111パーセント' 
            しない が存在する選択 1 
                  からbfacctitleaccrlat2019 Bの
                  b.ledger = T.ledger
                     b.accounttitlecode  T.accounttitlecode || ' _%' ))B
  b.accounttitlecode よう a.accounttitlecode || ' '  a.ledger = b.ledger  
 グループ によって a.accounttitlecode、b.currency

 

おすすめ

転載: www.cnblogs.com/wolbo/p/11285072.html