sql server 2005 A字段相同数据的B字段合并
如图,写出查询语句结果为
查询语句为:select
difficultName ,
(STUFF((select ';'+area FROM MoneyAndArea WHERE difficultName=b.difficultName
ORDER BY difficultName FOR XML PATH('')),1,1,'')) AS area,
(STUFF((select ';'+[money] FROM MoneyAndArea WHERE difficultName=b.difficultName
ORDER BY difficultName FOR XML PATH('')),1,1,'')) AS [money]
from MoneyAndArea b
group by difficultName