Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> CONCATENATE a field's values when GROUPING BY another field
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
![]() |
![]() |