阅读背景:

mysql where 查询在某个时间段内的sql语句

来源:互联网 

if ($starttime=="" and $endtime==""){
        //查询从当天倒回30的数据,如果查询数据库两个时间可以直接引用	$starttime=date("Y-m-d", strtotime("-30 days", time()));//-30;从现在时间倒回30	$endtime=date("Y-m-d");}select * from services where DATE_FORMAT(laifangtime, '%Y-%m-%d') >= '$starttime' and DATE_FORMAT(laifangtime, '%Y-%m-%d') <= '$endtime'    



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: