拼接多个逗号隔开的id,取出对应名称
SELECT [ID] ,[APP_NAME] ,[TYPE] ,[DESCRIBE] ,[UPDATE_FILE] ,[UPDATE_TIME] ,se.[U_ID] ,se.[CREATE_TIME] ,su.REALNAME as UNAME ,DIC.TYPENAME AS PTNAME ,replace(replace( stuff( ( (SELECT ' #a target="_blank" href="/' + FILEPATH +'"$'+FILETILE + '#/a$' FROM SYS_ATTACHMENT WHERE ','+UPDATE_FILE+',' like '%,'+CAST(AID AS VARCHAR(50))+',%' FOR XML PATH(''))),1,1 ,''),'#','<'),'$','>') href FROM [dbo].[EMPS_SYSTEM_UPDATE] as se left join SYS_USER as su on su.U_ID = se.U_ID LEFT JOIN SYS_PUBLICTYPEINFO AS DIC ON DIC.TYPEVALUE = se.APP_NAME AND SIGN = 2010
吾乃代码搬运工,侵联删