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 -> Re: Concatenating multiple rows?

Re: Concatenating multiple rows?

From: programmer <int.consult_at_macmail.com>
Date: Thu, 26 Jun 2003 15:28:44 +0100
Message-ID: <bdf0di$emg$1@pheidippides.axion.bt.co.uk>


> select a.field1 || ',' || b.field1 || ',' || c.field1
> into abcfield
> from table1 a,
> table1 b,
> table1 c
> where a.field1 = 'aaa'
> and b.field1 = 'bbb'
> and c.field1 = 'ccc'
>
> Sorry - I know this is probably not what was meant ;)
>
> Greg

I came up with something similar:

SELECT distinct t1.field1 || ',' || t2.field1 || ',' || t3.field1 FROM table1 t1, table1 t2, table1 t3
where t1.field1 < t2.field1
and t2.field1 < t3.field1;

It can be extended for as many values as you want, but it only works if there are exactly that many records in the table. Received on Thu Jun 26 2003 - 09:28:44 CDT

Original text of this message

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