//aps,building,square关联 $list = DB::table('aps') ->join('building','building.id', '=' ,'aps.building_id') ->join('square','square.id', '=' ,'aps.campus_id') ->join('sys_location_info','sys_location_info.location_id' ,'=', 'square.location_id') ->select('square.location_id','building.id as dev_code','building.building_name as dev_name','aps.mac as apmac') ->get(); if($list){ $lists = $list->toJson(); }else{ $lists =''; } return $lists;
多表之间的关联查询