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

 

 

posted @ 2023-11-24 16:02  ITMrRight  阅读(11)  评论(0编辑  收藏  举报