Chapter 13 – OLAP Functions

“Don’t count the days, make the days count.”

- Mohammed Ali

CSUM

image

This ANSI version of CSUM is SUM() Over. Right now, the syntax wants to see the sum of the Daily_Sales after it is first sorted by Sale_Date. Rows Unbounded Preceding makes this a CSUM. The ANSI Syntax seems difficult, but only at first.

CSUM – The Sort Explained

SELECT    Product_ID , Sale_Date, Daily_Sales,

SUM(Daily_Sales) OVER (ORDER BY Sale_Date

ROWS UNBOUNDED PRECEDING)    AS SUMOVER

FROM  Sales_Table WHERE Product_ID BETWEEN 1000 and 2000 ;

image

The ...

Get Actian Matrix (Formely ParAccel) - Architecture and SQL now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.