5 Replies Latest reply: Nov 11, 2015 11:36 AM by Sunny Talwar RSS

    above row value - QV script

    dvir SEGAL

      Hello All

      I have a question

      my table is

       

      cust_no   transaction_date

      100          01/01/2015

      100          08/02/2015

      100          12/04/2015

      200          08/11/2015

      200          10/12/2015

      I want to do 2 things:

      1. new field that is doing something like rownum() in sql

      2.new field that giving each row the date above it

       

      all of this by doing only once "order by" on resident

       

      the table that I want should look like:

      cust_no   transaction_date  end_date         rank

      100          01/01/2015          08/02/2015      1

      100          08/02/2015         12/04/2015       2

      100          12/04/2015         sysdate           3

      200          08/11/2015          10/12/2015     1

      200          10/12/2015          sysdate          2