使用 stuff函数
select field1, stuff((select ','+field2 from table t where l_id in (1,2,3,4,5,6,7,8,9) and t.l_id=s.l_id for xml path('')), 1, 1, '') field2 from table s where l_id in (1,2,3,4,5,6,7,8,9) group by l_id