sql - Group_concat equivalent in postgresql 8.2.11 -


i using older version of postgres 8.2.11. can tell me equivalent of mysql's group_concat postgres 8.2.11. have tried array_accum , array_to_string , string_agg doesn't work in version

the "not quite duplicate" in comments should point in right direction: create own aggregate function. first you'll need non-aggregate string concatenation function, this:

create function concat(t1 text, t2 text) returns text $$ begin     return t1 || t2; end; $$ language plpgsql; 

then can define own aggregate version of function:

create aggregate group_concat(     sfunc    = concat,     basetype = text,     stype    = text,     initcond = '' ); 

now can group_concat want:

select group_concat(s) t group g 

i dug out of archives think should work in 8.2.

keep in mind 8.2 no longer supported might want upgrade @ least 8.4 possible.


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

reactjs - React router and this.props.children - how to pass state to this.props.children -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -