tp5并表查询整理

php

浏览数:554

2019-1-13

    $list=$release->alias('a')
               ->join('purchase_company b','a.company_id=b.com_id','left')
               ->join('service_user c','c.sid=a.sid','left')
               ->join('service_statis d','d.type=2 and d.handle_id=a.id','left')
               ->join('purchase_user e','e.cid=a.cid','left')
               ->where(array('a.sid'=>$this->sid,'a.data'=>$data,'a.order_type'=>4))
               ->field('a.id,a.order_num,a.order_type,a.up_username as fbr,FROM_UNIXTIME(a.create_time,"%Y-%m-%d %H:%i:%s") as fb_time,b.company_name,c.name as slr,FROM_UNIXTIME(d.creat_time,"%Y-%m-%d %H:%i:%s") as sl_time,e.user_name as yslr')
               ->page($page)
               ->paginate(10);