Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
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.
string_agg(name,',')
abc,d,e,f,g
string_agg
N
abc,d,e,...
ab...
LIMIT 10
You can just take the first "n" characters after doing the aggregation:
select left(string_agg(name, ','), N) as FirstN
Add a comment
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
LIMIT 10for example?