【发布时间】:2017-11-23 09:39:47
【问题描述】:
我需要获取 DATEDDIFF() >30 和
我尝试过查询,但它不起作用。
如何获取符合条件的数据。
我的查询是,
$cur_date=Carbon::now();
$data=DB::table('mailbox_log as ml')
->leftjoin('registration as r','ml.reg_id','=','r.id')
->leftjoin('company as cmp','r.sociale_id','=','cmp.id')
->select('ml.*','r.id','r.g_id','r.num','cmp.name')
->where(DB::raw('DATEDIFF(ml.sent_pst_date, "%Y-%m-%d")'),$cur_date->format('Y-m-d'),'>','30')
->where(DB::raw('DATEDIFF(ml.sent_pst_date, "%Y-%m-%d")'),$cur_date->format('Y-m-d'),'<','60')
->get()->toArray();
【问题讨论】:
标签: mysql database laravel datediff