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]