用SQL查询一批数据,怎么在最后一行增加个数字合计
2016-02-07
展开全部
select mc,sum(sl) as 数量,sum(jie) as 金额,b.xm
from a,b where a.id=b.id and a.id=1 group by a.mc,b.xm
union
select '合计' as mc,sum(sl) as 数量,sum(jie) as 金额,b.xm
from a,b where a.id=b.id and a.id=1
group by a.mc
order by mc
from a,b where a.id=b.id and a.id=1 group by a.mc,b.xm
union
select '合计' as mc,sum(sl) as 数量,sum(jie) as 金额,b.xm
from a,b where a.id=b.id and a.id=1
group by a.mc
order by mc
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询