return 1 formatted result instead of multiple results

Started by Acmover 18 years ago2 messagesgeneral
Jump to latest
#1Acm
alextabone@gmail.com

I want to query a column in a table that returns multiple records,
append the values of that column in a comma separated string, and
return that string.

example: select * from people;
returns 3 results:
Mike
John
Dennis

and I want one result to be "Mike,John,Dennis".

How can I format my results in this way using SQL (preferably not
stored functions)?

Thank you.

#2Rodrigo De León
rdeleonp@gmail.com
In reply to: Acm (#1)
Re: return 1 formatted result instead of multiple results

On 8/31/07, Acm <alextabone@gmail.com> wrote:

and I want one result to be "Mike,John,Dennis".

SELECT ARRAY_TO_STRING(ARRAY(SELECT * FROM PEOPLE),',') AS FOO