0

我无法汇总 cds 视图中的数据。在 Hana 计算视图的早期,以下查询根据我的意愿给我结果

Select t1.ID, t1.Name, t1.qty, t2.amount from T1 Inner join (select ID, Name, Sum (amount) from t2 group by ID, Name) as T2

但是cd中的金额总和不正确..请帮助

4

1 回答 1

1

您可以在 SELECT 语句中使用聚合表达式。这样,您可以从结果集的多行调用聚合函数:

@AbapCatalog.sqlViewName: 'SALES_ORDER_VW'
define view sales_order as
select from snwd_so
{ key buyer_guid,
   @Semantics.currencyCode
    currency_code,
   @Semantics.amount.currencyCode: 'currency_code'
    sum(gross_amount) as sum_gross_amount }
group by buyer_guid, currency_code

因此,在您看来,您可以执行以下操作:

sum(name_of_field) as sum_of_field
于 2017-12-19T21:23:24.917 回答