Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Concatenating multiple rows?
> 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
![]() |
![]() |