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  陈跳跳  阅读(4052)  评论(0编辑  收藏  举报