Re: Return rows as 1 line?

From: The Magnet <art_at_unsu.com>
Date: Mon, 17 May 2010 18:36:11 -0700 (PDT)
Message-ID: <2f62eca6-5b93-4f4a-8efc-1c28f4ec7d72_at_a16g2000vbr.googlegroups.com>



On May 17, 4:02 pm, joel garry <joel-ga..._at_home.com> wrote:
> On May 17, 1:17 pm, The Magnet <a..._at_unsu.com> wrote:
>
>
>
> > Hi,
>
> > Ok, I am hoping this is now going to be nuts, but say I have data like
> > this:
>
> > ID    PRODUCT     SKU
> > 1         ABC           123
> > 1         DEF           456
> > 2         XYZ            000
> > 2         MNO          999
> > 3         GHI            888
>
> > And this is what I would need:
>
> > 1,ABC:123,DEF:456
> > 2,XYZ:000,MNO:999
> > 3,GHI:888
>
> > So, records that have a certain criteria would have certain columns
> > concatenated.  I'm thinking of putting together a dynamic query and
> > then opening a cursor and selecting from it, creating the string as I
> > go along.
>
> > Any thoughts?  I'm going to go with the dynamic cursor unless someone
> > else has a better idea.
>
> http://asktom.oracle.com/pls/asktom/f?p=100:11:4579694231612304::::P1...
>
> jg
> --
> _at_home.com is bogus.
> B of A branch in a van down by the river (click on aerial or birds-eye
> view):http://locators.bankofamerica.com/locator/locator/3881__Alton__Parkwa...

The problem is much more complex than that. Here is the select statement:

SELECT article_id, teaser_subject, publish_date, status_id, user_id, category_id, username, status_text, category_type, "TAG DATA"

Where you see the "TAG DATA" element, I'll need to get values in this format: "1:A,2:B,3:C"...... from the table.

So, I do not think GROUP BY will work in this situation.

BTW: We are on 10G. I've looked at some of the CONNECT BY stuff, but not sure that will work. Received on Mon May 17 2010 - 20:36:11 CDT

Original text of this message