举例:使用时间序列函数TimekeyttSales Sales_last_year Sales_change 98-1 1100 t- t - …..tt…t... 99-1tt1200tt1100t100 99-2tt1500tt1450t50 99-3tt1700tt1350t250 99-4tt1600tt1700t-100t 99-5tt1800tt1600t200 99-6tt1500tt1450t50 99-7tt1300tt1250t50 99-8tt1400tt1200t SELECT timekey, sales, LAG(sales,12) OVER (ORDER BY timekey) as sales_last_year, (sales - sales_last_year) as sales_change FROM sales