|  |  | Archives of the TeradataForumMessage Posted: Mon, 08 Sep 2003 @ 16:06:27 GMT
 
 
  
| Subj: |  | Re: LEAD/LAG Analysis |  |  |  | From: |  | Swarnapuri, Vinod |  
 The example given is helpful if we have to order by the same field as the output field. Is it possible to do if they are not the
same. For example : 
Sales_man_id    month              Total Sales
----------------------------------------------
1               JAN-2003           $50,000
1               FEB-2003           $55,000
1               MAR-2003           $40,000
2               JAN-2003           $25,000
3               MAR-2003           $40,000
 Supposing that the current month is Mar-2003 and we need sales_man_id, current_month, Total sale amount during the current month and
total sale amount during the previous month. 
 
 |  |