Re: How to do this trick ?
Date: Fri, 15 Oct 1999 11:19:28 +0300
Message-ID: <3806E390.F56FB2B0_at_fors.ru>
Hi, Abu. Try this:
select
A.mynumber,
A.mynumber - B.mynumber DIFF
from
mytable A ,
mytable B
where
B.mynumber = (select max(mynumber) from mytable where mynumber < A.mynumber );
You will get:
MYNUMBER DIFF ---------- ------- 3 2 5 2 10 5
Sorry, it's only the direction for research. As You see, problem of the first value remains.
Norazman Abu Sahir wrote:
> Hi,
> I have a table with one colum. When I do a select below are the data.
>
> SQL> SELECT MYNUMBER FROM TESTING;
>
> MYNUMBER
> ----------
> 1
> 3
> 5
> 10
>
> What I would like to do is how to display a different betwen a row value
> with a previous row value.
> Something like this:
>
> MYNUMBER DIFF
> ---------- -------
> 1 0
> 3 2
> 5 2
> 10 5
>
> Have any idea?
> TIA
Received on Fri Oct 15 1999 - 10:19:28 CEST