select staffId, (SELECT MachineIP+ ',' FROM STAFF_ATTENDANCE r WHERE r.staffId= 55 FOR XML PATH('') ) gg from STAFF_ATTENDANCE a group by a.staffId