Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> A SQL question.
Hi all.
I would appreciate any help available on this problem.
I have to print some data as a report using an SQL statement. It's a line-item and control break kind of report. For example I have these...
Type CodeNo Price A2 0912 14.00 A2 0913 16.00 A2 0914 15.00 A4 1150 25.00 A2 0916 18.00 A4 1152 29.00 A4 1153 29.00
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 - 09:14:43 CDT