读书人

查询不同月度不同客户的数据记录

发布时间: 2012-09-09 09:27:54 作者: rapoo

查询不同月份不同客户的数据记录

对于数据库不熟悉的需要对下面这个示例进行熟悉

?

select ordermonth 月份,consignment 客户,sum(goodscount) 发货总数量,sum(volume) 发货总体积,sum(weight) 发货总重量
from
(
select SUBSTR(to_char(b.order_time,'YYYY-mm'),1,7) ordermonth,
b.goods_count goodscount,b.volume volume,b.weight weight,
b.consignment_id consignment
from bus_temp_order b
where b.order_time between sysdate-365 and sysdate)
group by ordermonth,consignment
order by consignment

读书人网 >其他数据库

热点推荐