Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Sql for generating one string out of several records

Sql for generating one string out of several records

From: Sindre Idsal <sidsal_at_online.no>
Date: Sun, 7 Oct 2001 20:17:32 +0100
Message-ID: <9W0w7.11674$tu6.274758@news1.oke.nextra.no>


I have a situation where I've got a table with say two coloumns, named GROUP_NAME and TEXT.
So a sample content of this table might be: GROUP_NAME TEXT


GRP1                     London
GRP1                     Washington
GRP1                     Hamburg
GRP2                     Sunday
GRP2                     Monday
GRP2                     Wednesday

I need a sql something like this:

select ...(something....)
from DEMO_TABLE
where GROUP_NAME = 'GRP1'

and this should give me a string like this: 'London,Washington,Hamburg'

I know that I can write a function which has GroupName as an inputparameter and that returns the wanted string. But I need to be able to solve this problem with an ordinary sql - ie without any userdefined function.

I would appreciate very much any help on this matter.

Regards Sindre Idsal Received on Sun Oct 07 2001 - 14:17:32 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US