sql将一列的值查询出一行输出用逗号割开
select sys_username from Hy_Bpc
select (select ltrim(sys_username)+',' from Hy_Bpc for xml path('')) as A
执行效果效果如下
select sys_username from Hy_Bpc
select (select ltrim(sys_username)+',' from Hy_Bpc for xml path('')) as A
执行效果效果如下