Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: CONCATENATE a field's values when GROUPING BY another field
"Vincent C." wrote:
> 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
Two suggestions.
-- Daniel Morgan http://www.outreach.washington.edu/extinfo/certprog/oad/oad_crs.asp damorgan_at_x.washington.edu (replace 'x' with a 'u' to reply)Received on Wed Jul 02 2003 - 11:11:19 CDT
![]() |
![]() |