按月统计订单,查库怎么查?

rt,按月显示每月的相关数据,是把时间截成月的区间然后group by吗?

回复讨论(解决方案)

对!

对!

试了下,但是查不出month
“select date_format(add_time,’%y-%m’) as month, sum(order_amount) from zb_order where order_state=’40’ group by month”;

对!

试了下,但是查不出month
“select date_format(add_time,’%y-%m’) as month, sum(order_amount) from zb_order where order_state=’40’ group by month”;

原来漏了个from_unixtime

你这样写是对的

报什么错?

Posted in 未分类