sqlserver 中将存入值编码‘01,02,03’查询返回编码对应名称‘张三,李四,王五’
select
(select MouldName from mould_Mould where MouldCode=a.MouldCode) MouldName,
(select Specs from mould_Mould where MouldCode=a.MouldCode) MouldSpecs,
STUFF((
SELECT ',' + f.ProcessName
FROM mes_Process f
WHERE CHARINDEX(',' + f.ProcessCode + ',', ',' + a.ProcessCode + ',') > 0
FOR XML PATH(''), TYPE
).value('.', 'VARCHAR(MAX)'), 1, 1, '') AS ProcessName,
* from [dbo].[mould_MaterialBindMould] a where 1=1