Quantcast
Channel: SCN: Message List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 9165

WHAT IS DATENAME EQUIVQLENT FUNCTION IN HANA

$
0
0

Hello experts,

 

Can anyone please help me in providing datename equivalent function in hana

 

below is the sql query after  execution  of this query i am getting 78 rows

 

select distinct REGION,0,[u_month_begin_date] ,

                 

SELECT REGION, sum(MetricValue) MV,[u_month_begin_date],mth

                from

                     ( select  M.REGION, sum(MetricValue) MetricValue,[u_month_begin_date],mth

                    FROM MARKETING.dbo.TBL_MKT_SNUG_SIG_METRICS SS

                        INNER JOIN MARKETING.dbo.TBL_MKT_SNUG_SIG_MAP M ON SS.[GroupName] = M.SNUG_SIG_GROUP AND M.REGION <> 'SIG'

                        INNER JOIN [Sales].[dbo].[T_PL_DATE_DIMENSION] ON YR=[u_year_num] AND rtrim(ltrim(substring(mth,PATINDEX('%-%',mth)+1,10)))=[u_month_name]

                    WHERE lvl='M' --AND [u_month_begin_date]='2014-01-01'

                      AND [u_day_num_of_month]='1'

                      GROUP BY REGION, [u_month_begin_date],mth

                    union

                    select distinct REGION,0,[u_month_begin_date] ,

                    datename(year,[u_month_begin_date])+'-'+datename(month,[u_month_begin_date])

                    from MARKETING.dbo.TBL_MKT_SNUG_SIG_MAP m ,[Sales].[dbo].[T_PL_DATE_DIMENSION] dt

                    where  [u_day_num_of_month]='1'

                    and u_date<=dateadd(mm,-1,getdate())

                    and u_year_num>2015

                    and Region <>'SIG'

                ) v2

                GROUP BY REGION, [u_month_begin_date],mth

            ) v1

 

        GROUP BY REGION, [u_month_begin_date],mth,mv

 

 

 

 

below is hana equivalent sql query, after execution of this query i am getting 82 rows basically here hana is creating four duplicated rows

 

note: in hana 4 more rows are created with out any data for eg: for ams region 2016-1 with o mv and running total value for more information

 

 

Regards

Naresh P


Viewing all articles
Browse latest Browse all 9165

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>