THinkPhp or+leftjoin+field查询

2017-09-15  本文已影响0人  5990
$model=M('erp_jiaoqi');
$tiaojian='';
return $model
//字段
      ->field('erp_so.createtime,erp_so.changetime,erp_jiaoqi.po,erp_jiaoqi.qty,erp_jiaoqi.spc,erp_jiaoqi.pkid,erp_jiaoqi.so,erp_jiaoqi.cust,erp_jiaoqi.jiaoqi,erp_jiaoqi.prd_no,erp_jiaoqi.prd_name')
//链接表
                ->join('left join erp_so on erp_jiaoqi.so = erp_so.cgnum')
//条件
                ->where([
                    'so|po|prd_no'=>$tiaojian,
                    '_logic'=>'OR'
                ])
                ->limit($page,20)
//排序
                ->order('erp_jiaoqi.pkid desc')
                ->select();
上一篇下一篇

猜你喜欢

热点阅读