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

Home -> Community -> Usenet -> c.d.o.misc -> Re: advanced SQL

Re: advanced SQL

From: tojo <Tojo_at_hotmail.com>
Date: Mon, 13 Jan 2003 16:32:31 +0100
Message-ID: <MPG.188cfa75763a6c729896df@news.t-online.de>


In article <fe136e10.0301130456.bc01810_at_posting.google.com>, iltrex_at_libero.it says...
> Hello
> I need to write a query that, from this table:
>
> A 3
> A 5
> B 3
> A 9
> C 8
> B 7
>
> extracts this:
>
> 1 A 3
> 2 A 5
> 3 A 9
> 1 B 3
> 2 B 7
> 1 C 8
>
> That is, a counter that reset to 1 every time a field changes.
>
> I read a while ago an article on oracle magazine about an advanced sql
> keyword that could accomplish this, but I've not that paper at hand
>

You must mean the analytical functions (8i and up):

 select

    row_number() over (partition by charfield order by charfield),     charfield,
    numfield,
 from bc4j.test

1	A	3
2	A	5
3	A	9
1	B	3
2	B	7
1	C	8



Received on Mon Jan 13 2003 - 09:32:31 CST

Original text of this message

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