mysql根据月份统计金额

select FROM_UNIXTIME(createTime/1000,'%Y年%m月') as '时间',count(orderid) as '订单数量',sum(hasAmount*0.01) as '订单总额' from buyorder 

where state not in(1,-1) GROUP BY FROM_UNIXTIME(createTime/1000,'%Y年%m月')

猜你喜欢

转载自lee4.iteye.com/blog/2294247