Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: How to do this trick ?

Re: How to do this trick ?

From: Jan Nowitzky <nowitzky_at_informatik.uni-jena.de>
Date: Fri, 15 Oct 1999 12:44:57 +0200
Message-ID: <380705A9.B13A3E7@informatik.uni-jena.de>


Hi,

look at this:

create table a (n integer);

insert into a values (1);
insert into a values (3);
insert into a values (5);
insert into a values (10);

select * from a;

         N


         1
         3 
         5 
        10       

select c.n, min(c.n-b.n) from a b, a c where b.n(+)<c.n group by c.n;

         N MIN(C.N-B.
---------- ----------

         1
         3          2
         5          2
        10          5

So it works fine, but it wont work with duplicates in column n!

Hope it helps.
Regards, Jan

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
--



Jan Nowitzky
Friedrich-Schiller-Universität o Institut für Informatik E-Mail nowitzky_at_informatik.uni-jena.de
Received on Fri Oct 15 1999 - 05:44:57 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US