Analytics Functions Example 7: Grand Aggregate

Grand Aggregate Maximum

Get the maximum close value for IBM in the entire dataset (the first quarter of 2013):

 
    SELECT symbol, close, seq_max(close) FROM Quote WHERE symbol='IBM';
     
    symbol
    close{}
    max
    ------------------------------------------------------------------------------
    IBM
    {196.350006, 195.270004, 193.990005, 193.139999, 192.869995, 192.320007,
    192.880005, 194.449997, 192.619995, 192.500000, 192.589996, 193.649994,
    194.470001, 196.080002, 204.720001, 204.419998, 204.970001, 204.929993,
    203.899994, 203.520004, 203.070007, 205.179993, 203.789993, 202.789993,
    201.020004, 199.740005, 201.679993, 200.160004, 200.039993, 200.089996,
    199.649994, 200.979996, 200.320007, 199.309998, 198.330002, 201.089996,
    197.509995, 199.139999, 202.330002, 200.830002, 202.910004, 205.190002,
    206.529999, 208.380005, 209.419998, 210.380005, 210.080002, 210.550003,
    212.059998, 215.800003, 214.919998, 213.210007, 213.440002, 215.059998,
    212.259995, 212.080002, 210.740005, 212.360001, 210.889999, 213.300003}
    215.800003
            
     

To run this example

A sample script to demonstrate this select statement using xSQL can be run from the samples/xsql/scripts/financial directory with the following command:

     
    x 7