Skip to content
Advertisement

Is it Possible to Merge Rows in SQL from Just One Column?

I wonder if it is possible to merge multiple rows from just one column in SQL. Here’s an example of my initial table:

Here’s my expected output:

I do not know if it’s possible to have a table like the later one. So, any advice would be much appreciated.

Advertisement

Answer

This type of task is usually done in the presentation layer of the application rather than in the database.

But it can be done in SQL – provided that you have a column that defines the ordering of the rows! Say: id.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement