摘要: Sql 合并行如下:IDName1Tom1John2Carrier2Wendy1Rick要求显示下列结果IDName1Tom,John,Rick2Carrier,WendySql:select id,(SELECT STUFF(b.v.value('/r[1]','varchar(100)'),1,1,'')FROM(SELECT v=(SELECT ',' + Name FROM TableName where id=c.idFOR XML PATH(''),ROOT('r'),TYPE)) b) 阅读全文
posted @ 2011-03-28 16:42 TNTZWC 阅读(521) 评论(0) 推荐(0) 编辑