1
在SQL Server 2012中,当我运行:SQL服务器 - 结合行成一个字段为每个客户
SELECT Customer, Fruit
FROM Customers_DB
我得到以下的输出:
| Customer | Fruit |
| A0001 | Apple |
| A0001 | Pear |
| A0002 | Banana |
| A0003 | Pear |
| A0004 | Grape |
| A0004 | Apricot |
我将如何实现以下输出,动态?
| Customer | Fruit |
| A0001 | Apple + Pear |
| A0002 | Banana |
| A0003 | Pear |
| A0004 | Apricot + Grape |
我注意到水果被连接起来(也许Coalesce
“按字母顺序d)。
HTTPS:/ /stackoverflow.com/questions/451415/simulating-group-concat-mysql-function-in-microsoft-sql-server-2005 –
这已被问及答复数千次。 –
@SeanLange然后你为什么只发布一个孤独的问题和答案? –