0

Is it possible to merged multiple values in one column using SQL? (the value is being separated via comma)

For example, I have this data:

Ids
1
2
3
4
5
6

Then I want it to return like this:

Ids
1,2,3,4,5,6
3
  • 1
    SELECT string_agg(Id::text,',') FROM table_name Demo Commented Mar 12, 2016 at 11:23
  • 1
    @lad2025 thank you very much! just what i need... Commented Mar 12, 2016 at 11:54
  • You're welcome. I had to close it because it is obvious duplicate. Good luck with learning Postgresql :) Commented Mar 12, 2016 at 11:55

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.