【发布时间】:2010-09-27 22:34:32
【问题描述】:
我有这样的数据
Investor Contact
IBM James
IBM Dean
IBM Sean
Microsoft Bill
Microsoft Steve
我需要数据看起来像这样
Investor Contact
IBM James,Dean,Sean
Microsoft Bill,Steve
或者如果以上是不可能的
Investor Contact1 Contact2 Contact3 ...
IBM James Dean Sean
Microsoft Bill Steve
【问题讨论】:
-
如果您使用 MySQL,答案将是 GROUP_CONCAT()。既然你不是,你需要一个等价物。见SO 2852892 和SO 3389347
-
@Jonathan Leffler:必须了解 GROUP_CONCAT 才能找到它,但 this question also fits the bill
标签: sql sql-server sql-server-2005 tsql