Cálculo da mediana em Sap Hana
Uma ideia muito boa, encontrada em http://sqlblog.com/blogs/adam_machanic/archive/2006/12/18/medians-row-numbers-and-performance.aspx SELECT CustomerId, AVG(TotalDue)FROM( SELECT CustomerId, TotalDue, ROW_NUMBER() OVER ( PARTITION BY CustomerId ORDER BY TotalDue ASC, SalesOrderId ASC) AS RowAsc, ROW_NUMBER() OVER ( …
Continuar lendo