简体   繁体   中英

Postgres array concatenation function

Does Postgres have a function to transform an array into a single value? For example, I'd like to do something like:

reduce(ARRAY['one','two']) -> onetwo , or even better: reduce(ARRAY['one','two], ', ') -> one, two

If not, how would I go about implementing that in my query. I know of unnest , but that just gives me one row per array element

As in the comments:

select array_to_string(array['one','two'],',');
 array_to_string 
-----------------
 one,two

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM