比较笨的sql
select dwdm, mc, sum(je)
(
select dwdm,mc1 mc,je1 je from tablename
union all
select dwdm,mc2 mc,je2 je from tablename
union all
select dwdm,mc3 mc,je3 je from tablename
union all
select dwdm,mc4 mc,je4 je from tablename
union all
select dwdm,mc5 mc,je5 je from tablename
)
group by dwdm,mc作者: renxiao2003 时间: 2011-03-22 11:18
参加ITPUB的SQL大赛吧。