我有一个有效的查询,但是我想添加一个子句,只显示30天后有'tbldomains.nextduedate'的记录。
Capsule::table('tblhosting')
->select('*','tbldomains.nextduedate as domainnextduedate' , 'tblhosting.nextduedate as hostingnextduedate','tbldomains.id as domainid' , 'tblhosting.id as hostingid')
->join('tblclients', 'tblhosting.userid', '=', 'tblclients.id')
->join('tbldomains', 'tblhosting.domain', '=', 'tbldomains.domain')
->whereColumn('tblhosting.nextduedate', '!=', 'tbldomains.nextduedate')
->where('tbldomains.status', '=', 'Active')
->whereDate('tblhosting.termination_date', '=', '0000-00-00')
->where('tblhosting.nextduedate', '!=', '0000-00-00')
->where('tblhosting.server', '!=', '0')
->get()
我尝试了什么:
->where(Capsule::raw('DATEDIFF(CURDATE(),tbldomains.nextduedate)'),'>','30')
但这似乎并不适用于Laravel
谢谢!