天天看点

多行数据转换成一个字符串

select STUFF(

                    (select ','+UserID

                    FROM T_WorkFlow_MultiFlowInfo  a

                    WHERE b.FlowID =a.FlowID 

                    and a.isWork=0 and a.FlowType<>3 and a.flowid='{0}'

                    FOR XML PATH('')),1,1,'')UserID

                    FROM T_WorkFlow_MultiFlowInfo b

                    where b.isWork=0 and b.FlowType<>3 and b.flowid='{0}'

                    group by FlowID