如何解决where查询将数据库字段名自动生成为文本值

浏览:309 发布日期:2020/06/11 分类:求助交流 关键字: where Between
$res = Db::table('cus_service')
        ->alias('cus')
        ->join('admin adm','cus.admin_id = adm.id')
        ->where('adm.apitoken',$no)
        ->where('cus.status',1)
        ->whereBetween("DATE_FORMAT(NOW(),'%T')",['cus.enabletime','cus.disabletime'])
        ->order('cus.id desc')
        ->field(['cus.id','cus.weixin','cus.mobile','cus.cname','cus.qrcode','cus.enabletime','cus.disabletime'])
        ->fetchSql(true)
        ->select();
这句代码:whereBetween("DATE_FORMAT(NOW(),'%T')",['cus.enabletime','cus.disabletime'])

cus.enabletime和cus.disabletime是对应的数据库字段名
最后会生成:
AND '10:02:59' Between 'cus.enabletime' AND 'cus.disabletime'

请教如何写才能解决将字段名生成为文本值
最佳答案
评论( 相关
后面还有条评论,点击查看>>