[Solved] Compare nth row with n+1 th row and if it lies in range of n th row print n+1th row USNG ORACLE QUERY only [duplicate]


Maybe something like this:

SELECT b.id 
FROM   iv_stock_details a, 
       iv_stock_details b 
WHERE  a.id + 1 = b.id 
       AND b.stock_stat_no >= a.stock_stat_no 
       AND b.stock_stat_no < a.stock_end_no 
       AND b.stock_end_no <= a.stock_end_no 
       AND b.stock_end_no > a.stock_stat_no; 

SQLFiddle: http://sqlfiddle.com/#!2/94722/7

solved Compare nth row with n+1 th row and if it lies in range of n th row print n+1th row USNG ORACLE QUERY only [duplicate]