查询出当天数据:
select * from `table` where date(时间字段) = curdate();
查询出当月字段:
select *
from `table`
where month( 时间字段) = month( now( ) ) ;
时间格式为1219876…… unix时间,只要应用“from_unixtime( )”函数
例如查询当月:
select *
from `table`
where month( from_unixtime( reg_time ) ) = month( now( ) ) ;
查询上一个月的呢?变通一下!
select *
from `table`
where month( from_unixtime( reg_time ) ) = month( now( ) ) -1;
就这么简单,复杂的以后再补充!
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!