select distinct fm_id, STUFF((select distinct ISNULL( ',' +SO_Num,'' ) from [t_BADItems] it WHERE it.fm_id=its.fm_id for xml path('') ),1,1,'') AS SO_Nums from [dbo].[t_BADItems] its
表内一对多 的关系查询
select distinct fm_id, STUFF((select distinct ISNULL( ',' +SO_Num,'' ) from [t_BADItems] it WHERE it.fm_id=its.fm_id for xml path('') ),1,1,'') AS SO_Nums from [dbo].[t_BADItems] its
表内一对多 的关系查询