SQLTeam.com | Weblogs | Forums

How to combine/append multiple values/rows of column B according to column A

I have a table that has 3 columns (ID, key, value).
like this:

As you see column key has repeated or same texts, but the value does not. I want to combine/append the texts of the column value into one field according to the column key separating them with a comma or newline. and also delete the repeated texts of the column key.
Is there any SQL query code to accomplish this?
I know that this may be against the SQL rules, but I need this table.
I don't want just SELECT; I want to UPDATE the table.
Thanks in advance.


So if you want an update what happens to previous data in the table?

The previous information will be deleted. as you see in the picture, the words in the key column are the same, so we pick one of them, and the words in the value column are different, so we append them to one of the words in the key column.