Re: string concatenation via Group By
Date: Tue, 26 Jan 2010 17:33:50 +0100
Message-ID: <4b5f196b$0$21313$426a74cc_at_news.free.fr>
<dn.perl_at_gmail.com> a écrit dans le message de news: a122dd75-b1d1-40cb-ac85-fdfb42510376_at_e37g2000yqn.googlegroups.com...
|
| Is it possible to concatenate records in a field via Group By clause
| of an SQL statement?
|
| Untested script is :
| create table t1(country varchar2(32), state varchar2(32), city varchar2
| (32)) ;
| insert into t1 values ('USA', 'CA', 'Sacramento') ;
| insert into t1 values ('USA', 'CA', 'San Jose') ;
| insert into t1 values ('USA', 'CA', 'three') ;
| insert into t1 values ('USA', 'CA', 'four') ;
| insert into t1 values ('USA', 'CA', 'Fremont') ;
| insert into t1 values ('Canada', 'OT', 'Ottawa') ;
| insert into t1 values ('Canada', 'OT', 'Toronto') ;
|
| Expected output for the SQL statement would be :
| USA CA Sacramento, San Jose, three, four, Fremont
| Canada OT Ottawa, Toronto
|
|
| Thanks in advance.
|
Yes, using T. Kyte's STRAGG function or WM_CONCAT one.
Regards
Michel
Received on Tue Jan 26 2010 - 10:33:50 CST