$data = $w -> field('id,picurl') -> select(); foreach ($data as $key => $value) { $data[$key]['logoes'] = $wa -> field('id,logo') -> where('classid='.$value['id']) -> select(); }
$data = $w -> field('id,picurl') -> select(); // $arr = $wa -> field('id,logo') -> wherein('classid',array_column($data,'id'))-> select(); $res = array_column($arr , null, 'id'); foreach ($data as $key => $value) { $data[$key]['logoes'] = $res[$value['id']]; }