Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Re: errata corrige !!! this sqlplus report it's difficult!
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)