排名前十的SAP HANA

时间:2014-06-02 13:59:49

标签: sap hana

是否可以创建一个视图来列出top-N或bottom-N以供设计工作室1.2使用?

我已经找到了创建存储过程所需的SQLScript,以便让我获得与下面相同的内容 -

BEGIN 
select 
"REGION",
"COUNTRY",
"CITY",
"Customer Name",
sum("Gross Sales"),
sum("Net Sales")
 from "USER1"."EXPO_SALES"
 GROUP BY "Customer Name",CITY,COUNTRY,REGION
 ORDER BY sum("Net Sales") Desc
 limit 10;
END;

如何将输出带入使用SAP Design Studio 1.2的视图中?

1 个答案:

答案 0 :(得分:1)

只需创建一个视图:

CREATE VIEW "USER1"."EXPO_SALES_10" (
"REGION",
"COUNTRY",
"CITY", 
"Customer Name",
"SUMOFGROSSSALES",
"SUMOFNETSALES" ) 
AS SELECT 
"REGION",
"COUNTRY",
"CITY",
"Customer Name",
sum("Gross Sales"),
sum("Net Sales")
 from "USER1"."EXPO_SALES"
 GROUP BY "Customer Name",CITY,COUNTRY,REGION
 ORDER BY sum("Net Sales") Desc
 limit 10
WITH READ ONLY;