SELECT * FROM CMAVG ( ON ibm_stock PARTITION BY name ORDER BY period TargetColumns ('stockprice') ) ORDER BY period;