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.
something like this:

Is there any SQL query code to accomplish this?
Thanks in advance.