mysql判断两个时间段是否有交集

    //判断两个时间段是否有交集
    private function checkTimeCross($start_time,$end_time){
        $sql = "select id from dkh_recharge_activity where ( status = 1 AND is_del = 0 ) AND ((start_time > {$start_time} AND start_time < {$end_time}) OR     (start_time < {$start_time} AND end_time > {$end_time}) OR (end_time > {$start_time} AND end_time < {$end_time}))";
        $getOne = $this->dkhRechargeActivityModel->baseExecuteSql($sql);

        return $getOne;
    }

 

posted @ 2017-01-17 18:27  一个人的孤独自白  阅读(3957)  评论(0编辑  收藏  举报