SELECT TBBSM,BJJCYY,Type,SCBS,LevelFlag,stuff((SELECT ',' + Reasons FROM I_CheckRule_NDBG e
WHERE TBBSM = f.TBBSM AND cast(e.BSM as CHAR) in (SELECT * from dbo.[fun_splitfg](f.BJJCYY,','))
FOR xml path('')),1, 1, '') Reasons from I_Info_NDBG_610700 f GROUP BY TBBSM,BJJCYY,Type,SCBS,LevelFlag