Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: SELECTing multiple rows to a single output line
"Barbara Boehmer" <baboehme_at_hotmail.com> wrote:
> I don't have your table structure, so the following may not be exactly
> what you want, but it should be close enough for you to modify it to
> suit your needs. I haven broken the query down, one step at a time,
> starting from the innermost query, so that you can see how it is
> constructed. The query at the bottom is all you need. The rest are
> just to demonstrate the process.
Barbara, your scheme works great for me but in anticipation that I might have to limit how many parts could be listed on a given line I wonder if there was a "clever" way to list only up to a certain number of parts per widget on a single line and then list the remaining ones on a different line but with the same widget printed at the beginning, just as in the starting line for the widget. So, something like this:
Widget1 part1,part2,part3
Widget1 part4,part5,part6
Widget1 part7
Widget2 part3,part5,part7
Widget3 part2,part4
So in the above example I could only list up to 3 parts on a line for
any widget.
I figure that if this can be done then probably the "COUNT(*) OVER
(PARTITION ...) method would have to be used somehow, but I'm at a loss
on how. Can you lend me a hand again?
Thanks,
Rudy
Received on Sat Aug 20 2005 - 18:07:05 CDT