用两个mysql函数
FROM_UNIXTIME( ordertime )将日期格式转换成时间戳
获取当前日期的月month( FROM_UNIXTIME( ordertime ) )
select month( FROM_UNIXTIME( ordertime ) ) , count( commodity_id )
FROM `order_info`
WHERE FROM_UNIXTIME( ordertime )
BETWEEN ‘2014-01-01‘
AND ‘2014-12-31‘
AND providerid =7
GROUP BY month( FROM_UNIXTIME( ordertime ) )
LIMIT 0 , 30
时间: 2024-11-17 17:14:13