Example: Window With Multiple Functions

This query defines a single (named) window and computes multiple function results over it:

SELECT p.ID, p.Description, s.quantity, s.ShipDate, SUM(s.Quantity) 
   OVER ws1, MIN(s.quantity) OVER ws1
FROM SalesOrderItems s 
JOIN Products p ON (s.ProductID =p.ID) 
  WHERE s.ShipDate BETWEEN '2000-01-09' AND'2000-01-17' 
  AND s.Quantity > 40 window ws1 
  AS(PARTITION BY productid 
  ORDER BY shipdate rows between unbounded preceding and current row)
ORDER BY p.id;
ID   Description   quantity   shipDate     SUM   MIN
---  -----------   --------   -----------  ---   ---
400  Cotton Cap          48    2000-01-09   48    48
401  Wool cap            48    2000-01-09   48    48
500  Cloth Visor         60    2000-01-14   60    60
500  Cloth Visor         60    2000-01-15  120    60
501  Plastic Visor       60    2000-01-14   60    60