Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: A SQL question.
Select count(*),type,codeno,price from ...
group by type,codeno,price;
Zhang Yiquan wrote:
>
> How would I make a query so that I can get the results returned as
> sorted by Type and then CodeNo with a running serial count for each
> Type? For example....
>
> Report Title
>
> Count Type CodeNo Price
> 1 A2 0912 14.00
> 2 A2 0913 16.00
> 3 A2 0914 15.00
> 4 A2 0916 18.00
> 1 A4 1150 25.00
> 2 A4 1152 29.00
> 3 A4 1153 29.00
>
> The thing here is HOW to produce that Count column that would reset at
> every change in Type? I've tried grouping and ordering and even
> rownum, but just cannot get it to reset to 1 at every change in Type.
>
> Thanks in advance!
Received on Fri Sep 18 1998 - 10:19:13 CDT