当前位置:编程学习 > C#/ASP.NET >>

水晶报表

在水晶报表中把如下的数据:
工序       数量    箱号
R21(总数)   40      001
R41 (次品数) 2      001
M21(正品数) 3       001


改成
总数    次品  正品  箱号
40      2     3      001

也就是把上面的三条数据变成一条。各位乡亲们怎么做啊?急急急!!!能实现吗?

--------------------编程问答-------------------- UPUPUPUPUPUP --------------------编程问答-------------------- 没人知道吗?
--------------------编程问答-------------------- 利用箱号进行分组
然后写公式
或者利用交叉报表 --------------------编程问答-------------------- 公式怎么写的啊?小弟刚刚接触水晶报表 --------------------编程问答-------------------- 一个SQL语句即可,行列转换:
select sum(zs) 总数,sum(zp) 正品,sum(cp) 次品,xh 型号 from (
select (select numb from table_name where gx like '%总数%') zs,0 zp,0 cp,xh from table_name t 
group by t.xh
union all 
select 0 zs,(select numb from table_name where gx like '%正品%') zp,0 cp,xh from table_name t 
group by t.xh
union all 
select 0 zs,0 zp,(select numb from table_name where gx like '%次品%') cp,xh from table_name t 
group by t.xh
) group by xh --------------------编程问答-------------------- 一个SQL语句即可,行列转换:
select sum(zs) 总数,sum(zp) 正品,sum(cp) 次品,xh 型号 from (
select (select numb from table_name where gx like '%总数%') zs,0 zp,0 cp,xh from table_name t 
group by t.xh
union all 
select 0 zs,(select numb from table_name where gx like '%正品%') zp,0 cp,xh from table_name t 
group by t.xh
union all 
select 0 zs,0 zp,(select numb from table_name where gx like '%次品%') cp,xh from table_name t 
group by t.xh
) group by xh --------------------编程问答-------------------- 以上SQL查询的结果是按“箱号”group by 的
补充:.NET技术 ,  C#
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,