We can get a comma delimited string from multiple rows using coalesce as shown below.
Since table variable is used, we need to execute whole query once. So to make easy to understand, I have added BEGIN and END block.
BEGIN
--Table variable declaration to store sample records
DECLARE @Table TABLE (FirstName varchar(256), LastName varchar(256))
--Inserting sample records into table variable @Table
INSERT INTO @Table (FirstName, LastName)
VALUES
('John','Smith'),
('Jane','Doe')
--Creating variable to store result
DECLARE @Names varchar(4000)
--Used COLESCE function, so it will concatenate comma seperated FirstName into @Names varible
SELECT @Names = COALESCE(@Names + ',', '') + FirstName
FROM @Table
--Now selecting actual result
SELECT @Names
END