Hello ddf. Lag function was perfect. I was reading all day about it and it's a perfect solution for me. When I have one row of data I can sort it by CR_DT, as you stated, but let's assume I have few columns like:
CR_DT COUNTRY STATE CITY CUM_SALES INCR_SALES Each sales person is in one table with CUM_SALES values in it. Each person is from countr, state and city. When records will be ordered by CR_DT, only the newest entry, regardless of the rest, will be caught into lag function. When I order lag by CR_DT, COUNTRY, STATE and CITY (in that order) it would also give me wrong last row as it will take the lowest/highest (depending on sort order) value from last column ordered (here is CITY). Can this lag function work for columns which are only the same? So INCR_SALES would count subtract from two New Yorks ordered by date :) This would accomplish my whole task and I will buy a beer for proper solution :D --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Oracle PL/SQL" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Oracle-PLSQL?hl=en -~----------~----~----~----~------~----~------~--~---
