码迷,mamicode.com
首页 > 其他好文 > 详细

月度出货数量及金额

时间:2018-09-29 11:14:23      阅读:221      评论:0      收藏:0      [点我收藏+]

标签:sele   rollup   group by   order by   sub   ring   group   substring   select   

use TEST go select * from ( select isnull(SUBSTRING(a.TG003,1,6),‘总计:‘) as 日期,sum(b.TH008) as 数量,sum(b.TH013)as 金额 from COPTG as a left join COPTH as b on a.TG001+a.TG002=b.TH001+b.TH002 left join INVMB as c on b.TH004 = c.MB001 where a.TG003 like ‘2018%‘ and c.MB005 = ‘101‘ GROUP BY SUBSTRING(a.TG003,1,6) with rollup ) as a ORDER BY a.日期

月度出货数量及金额

标签:sele   rollup   group by   order by   sub   ring   group   substring   select   

原文地址:http://blog.51cto.com/gongxi/2287384

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!