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: errata corrige !!! this sqlplus report it's difficult!

Re: errata corrige !!! this sqlplus report it's difficult!

From: Jurij Modic <jmodic_at_src.si>
Date: Mon, 08 Feb 1999 20:53:26 GMT
Message-ID: <36bf4d10.43443815@news.siol.net>


On Sat, 06 Feb 1999 19:54:48 GMT, m.panarese_at_flashnet.it (Max) wrote:

>...[SNIP]...
>So, I'd like a sqlplus report like this:
>
>a 1
>a 2
>b 1
>c 1
>c 2
>c 3
>d 1
>e 1
>f 1
>g 1
>g 2
>g 3
>
>
>got it ?
>
>I could not work it out!!!
>Any smart oracle programmer around???
>Please, help me writing a select which display
>an output/report as the one above.

With your data, the following query returns the wanted result:

SQL> SELECT x.rose, y.seq FROM
  2 (SELECT rose, COUNT(*) cnt FROM inc GROUP BY rose) x,   3 (SELECT ROWNUM seq FROM inc) y
  4 WHERE y.seq <= x.cnt
  5 ORDER BY x.rose, y.seq;

ROSE SEQ
---------- ----------

a                   1
a                   2
b                   1
c                   1
c                   2
c                   3
d                   1
e                   1
f                   1
g                   1
g                   2
g                   3

12 rows selected.

>please e-mail to : fn032944_at_flashnet.it
>thanks
>max from rome

HTH, Jurij Modic <jmodic_at_src.si>
Certified Oracle7 DBA (OCP)



The above opinions are mine and do not represent any official standpoints of my employer Received on Mon Feb 08 1999 - 14:53:26 CST

Original text of this message

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