Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Concatanating results in one string
Daniel Morgan (dmorgan_at_exesolutions.com) wrote:
: Joe Smith wrote:
: > Thanks for the answer. In fact, I'm imposed to return the results (e-mail
: > addresses of a particular user) in one single value, in the form of a comma
: > separated list.
But email allows the list to be spread over multiple lines, so you could just select each name, one per line, prepending a comma to each value except the first.
: >
: > Bye!
: >
: > "Alan Mills" <Alan.Mills_at_nospamservices.fujitsu.com> a écrit dans le message
: > de news: aqtku6$dut$1_at_news.icl.se...
: > >
: > > "Joe Smith" <nospam_at_nospam.com> wrote in message
: > > news:aqtjts$s97$1_at_news-reader10.wanadoo.fr...
: > > > Hi,
: > > >
: > > > I'm trying to do a query to return all the values in one column
: > > concatanated
: > > > as if it was only one result:
: > > >
: > > > Field
: > > > ====
: > > > "A"
: > > > "B"
: > > > "C"
: > > >
: > > >
: > > > select ??? from table ==> "ABC"
: > > >
: > > > Is this possible?
If the number of columns is fixed, then use a union to put the values into different columns, and then max() to get them into a single row. (Though this assumes there is a single value in each union column.)
(untested, but similiar works elsewhere)
select max(ONE), max(TWO), max(THREE)
from
(
select it ONE ,'','' from them where it = allowed_in_first_column
union
select '',it TWO ,'' from them where it = allowed_in_second_column
union
select '','',it THREE from them where it = allowed_in_third_column
)
Received on Wed Nov 13 2002 - 14:19:48 CST
![]() |
![]() |