日期:2014-05-17 浏览次数:20429 次
SELECT a.R_PC_P_TYPE , STUFF(( SELECT ',' + R_PC_p_USERNAME FROM tb b WHERE b.R_PC_p_USERNAME = a.R_PC_p_USERNAME FOR XML PATH('') ), 1, 1, '') 'R_PC_p_USERNAME ' , STUFF(( SELECT ',' + R_PC_P_USER FROM tb c WHERE c.R_PC_P_USER = a.R_PC_P_USER FOR XML PATH('') ), 1, 1, '') 'R_PC_P_USER' FROM tb a GROUP BY a.R_PC_P_TYPE
------解决方案--------------------
select R_PC_P_TYPE , R_PC_p_USERNAME = stuff((select ',' + R_PC_p_USERNAME from 数据表名称 t where R_PC_P_TYPE = tests.R_PC_P_TYPE for XML path('')) , 1 , 1 , ''), R_PC_P_USER= stuff((select ',' + R_PC_P_USER from 数据表名称 t where R_PC_P_TYPE = tests.R_PC_P_TYPE for XML path('')) , 1 , 1 , '') from 数据表名称 group by R_PC_P_TYPE
------解决方案--------------------
又慢了一步
------解决方案--------------------
------解决方案--------------------