日期:2014-05-17 浏览次数:20679 次
;with cte(id,mc,item,vl) as
(
select 2001,'车间1',0,2500
union all select 2002,'车间2',0,3000
union all select 2003,'车间3',0,2400
union all select 5001,'井A',1,88
union all select 5002,'井B',1,90
union all select 2001,'车间1',0,2100
union all select 2002,'车间2',0,2400
union all select 2003,'车间3',0,3100
union all select 5001,'井A',1,100
union all select 5002,'井B',1,105
)
select a.id as id1,a.mc as mc1 ,a.vl as vl1,b.id as id2,b.mc as mc2,b.vl as v12