sql server 多列转多行实现方法

select * from b_workOrder

select * from( SELECT work_order_id,work_level, roles,code
FROM
(SELECT work_order_id,work_level,operator_code,sqc_code,hqc_code
FROM b_workOrder where sqc_code <>'') p
UNPIVOT
(code FOR roles IN (operator_code,sqc_code,hqc_code))
AS unpvt) as a

posted @ 2015-06-03 17:35  流浪的程序员  阅读(4474)  评论(0编辑  收藏  举报