Reputation: 11579
For example, the function string_agg(name,',')
returns abc,d,e,f,g
.
Is there any way to set maximum length for the function string_agg
to return only first N
characters abc,d,e,...
or ab...
?
P.S. No matter how it will be splitted.
Upvotes: 0
Views: 2106
Reputation: 1269443
You can just take the first "n" characters after doing the aggregation:
select left(string_agg(name, ','), N) as FirstN
Upvotes: 1