PHP 三表联查

$list_info = Db::table('first_second_map')

->field('map.*,supplier.company_name,supplier.industry,supplier.logo,cate.category_name,u.user_name')

->alias('map')

->join('company supplier', 'map.second_id = supplier.id', 'left')

->join('category cate', 'map.category_id = cate.id', 'left')

->join('user u', 'map.contact = u.user_id', 'left')

->where('map.first_id', $company_id)

->where('supplier.company_name', 'like', '%' . $keywords . '%')

->limit($offset, $limit)

->order('map.create_time desc')

->select();

你可能感兴趣的:(PHP 三表联查)