string concatenation via Group By
From: <dn.perl_at_gmail.com>
Date: Tue, 26 Jan 2010 08:07:44 -0800 (PST)
Message-ID: <a122dd75-b1d1-40cb-ac85-fdfb42510376_at_e37g2000yqn.googlegroups.com>
Date: Tue, 26 Jan 2010 08:07:44 -0800 (PST)
Message-ID: <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, FremontCanada OT Ottawa, Toronto
Thanks in advance. Received on Tue Jan 26 2010 - 10:07:44 CST