MySql查询本月
select count(*) from tb_order where date_format( create_time, ‘%Y-%m’) = date_format(now(), ‘%Y-%m’)
Mysql查询上个月
select count(*) from tb_order where period_diff(date_format(now(),’%Y%m’), date_format(create_time,’%Y%m’)) = 1
MySql查询本月
select count(*) from tb_order where date_format( create_time, ‘%Y-%m’) = date_format(now(), ‘%Y-%m’)
Mysql查询上个月
select count(*) from tb_order where period_diff(date_format(now(),’%Y%m’), date_format(create_time,’%Y%m’)) = 1