SQL将某一字段多条记录合并为一个字段显示

 

select namelist=STUFF(REPLACE(REPLACE(( SELECT ID FROM [LotteryMatch] where GameDateTime > getdate() FOR XML AUTO ), '<LotteryMatch ID="', ','), '"/>', ''), 1, 1, '') from [LotteryMatch]

select namelist=STUFF(REPLACE(REPLACE(( SELECT ID FROM [LotteryMatch] where GameDateTime > getdate() FOR XML AUTO ), '<LotteryMatch ID="', ','), '"/>', ''), 1, 1, '') from [LotteryMatch]

 

posted @ 2010-07-08 14:44  陈跳跳  阅读(4114)  评论(0)    收藏  举报