Quantcast
Channel: SCN : Discussion List - SAP HANA and In-Memory Computing
Viewing all articles
Browse latest Browse all 5653

NTILE function in HANA SQL

$
0
0

Hi All,

 

I need to write an SQL in HANA, which would produce a similar result to an NTILE() in SQL 2008.

as per my knowledge NTILE function does not exist in HANA SQL. Has anybody written an SQL similar to this function?

e.g below the MSSQL 2008 code, which need to be re-written in HANA SQL.

 

select case when FLD1 in ('AA','XX')

then 'BB'

      else FLD1 end as FLD1,

 

  NTILE(3) Over (PARTITION by case when FLD1 in

   ('AA','XX')  then 'BB'

      else FLD1 end

   Order by FLD_Dis Asc) as Percentile,

     

  FLD_Dis,

  'ALL' as FLD2,

  'ALL' as FLD3,

 

  From

"SCHEMA"."TABLE1"

 

  where FLD2 >= 10

GROUP BY FLD3, FLD1, FLD2,FLD_Dis

   Order by 1,2,3,4;

 

Thanks

Ranjit


Viewing all articles
Browse latest Browse all 5653

Trending Articles



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