码迷,mamicode.com
首页 > 其他好文 > 详细

ABAP CDS ON HANA-(7)CDSビューでの集約

时间:2019-03-08 16:41:52      阅读:243      评论:0      收藏:0      [点我收藏+]

标签:contents   from   lines   iso   table   author   agg   auth   alt   

Aggregate expression in CDS View

 

An aggregate expression calculates a single value from an operand operand by calling an aggregate function from multiple rows of a results set. They need Group By clause to aggregate values from multiple rows and  the non-aggregated fields  are specified in the GROUP BY clause.

Aggregate Functions:

技术图片

Created a CDS view with below select with SUM function.

技术图片


@AbapCatalog.sqlViewName: ‘ZFLIGHT_VW’
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: ‘Flight View with Aggregation Operation’
define view Zflight_View 
as select from sflight
{
key sflight.carrid, 
key sflight.connid, 
sum( price ) as Total_Amount,
sflight.currency
} group by carrid, connid, currency

  


Data Preview:

技术图片

CDS view with SUM & COUNT functions

技术图片


@AbapCatalog.sqlViewName: ‘ZFLIGHT_VW’
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #CHECK
@EndUserText.label: ‘Flight View with Aggregation Operation’
define view Zflight_View 
as select from sflight
{
key sflight.carrid, 
key sflight.connid, 
sum( price ) as Total_Amount,
sflight.currency,
count( *) as Lines
} group by carrid, connid, currency

  


Data Preview

技术图片


SFLIGHT Table contents

技术图片

 

ABAP CDS ON HANA-(7)CDSビューでの集約

标签:contents   from   lines   iso   table   author   agg   auth   alt   

原文地址:https://www.cnblogs.com/yjyongil/p/10496526.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!