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

来源:互联网 发布:三层mac地址冲突 编辑:程序博客网 时间:2024/06/05 17:56

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'


0 0
原创粉丝点击