I have a table like this
receipts_amt---fpn---date_run
------------------------------------
5000----------X01---03/15/2001
4000----------X01---04/15/2001
How can I get the difference of the receipts based on the date??? ( 5000-4000)
Printable View
I have a table like this
receipts_amt---fpn---date_run
------------------------------------
5000----------X01---03/15/2001
4000----------X01---04/15/2001
How can I get the difference of the receipts based on the date??? ( 5000-4000)
SELECT C.RECEIPTS_AMT - D.RECEIPTS_AMT
FROM (SELECT RECEIPTS_AMT FROM AMT A WHERE ROWID < ( SELECT MAX(ROWID) FROM AMT B WHERE A.FPN =B.FPN) ) C,
(SELECT RECEIPTS_AMT FROM AMT A WHERE ROWID > ( SELECT MIN(ROWID) FROM AMT B WHERE A.FPN =B.FPN) ) D
/