On SQL Server 2012, when I run:
SELECT Customer, Fruit
FROM Customers_DB
I get the following as outputs:
| Customer | Fruit |
| A0001 | Apple |
| A0001 | Pear |
| A0002 | Banana |
| A0003 | Pear |
| A0004 | Grape |
| A0004 | Apricot |
How would I achieve the following outputs, dynamically?
| Customer | Fruit |
| A0001 | Apple + Pear |
| A0002 | Banana |
| A0003 | Pear |
| A0004 | Apricot + Grape |
I note that the Fruit are concatenated (maybe Coalesce
'd in alphabetical order).