2

How do i remove the brackets {} from an Array_AGG query output?

ARRAY_AGG(DISTINCT(SGL.short_name))

from this {01,02} to this 01|02|

thanks!

user3263892
  • 93
  • 2
  • 9

2 Answers2

9

Use string_agg instead.

string_agg(DISTINCT SGL.short_name, '|')
Craig Ringer
  • 307,061
  • 76
  • 688
  • 778
6

Use array_to_string():

ARRAY_TO_STRING(ARRAY_AGG(DISTINCT(SGL.short_name)), '|')
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786