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 -> CONCATENATE a field's values when GROUPING BY another field

CONCATENATE a field's values when GROUPING BY another field

From: Vincent C. <vince_d_o_at_hotmail.com>
Date: 2 Jul 2003 08:38:19 -0700
Message-ID: <94f9a6a9.0307020738.424c9bff@posting.google.com>


Hello all,

I have a tricky SQL question. The following query

select username, expertise_code from exp_expertise where username = 'francesco';

returns the 5 lines below:

USERNAME                  EXPERTISE_CODE

----------------------- --------------
francesco A02 francesco G francesco G05 francesco A11 francesco A03

But I'd rather have only one line like this:

USERNAME                  EXPERTISE_CODE

----------------------- --------------
francesco A02,G,G05,A11,A03

In other words, I would like to "GROUP BY username" and find a way (with some aggregate function?) to concatenate the values for the EXPERTISE_CODE field (using a separator like a comma).

Any idea?

Thanks a lot.
Vincent Received on Wed Jul 02 2003 - 10:38:19 CDT

Original text of this message

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