I'm using GROUP\_CONCAT function to fetch multiple photo image paths for the selected professional in Laravel. The code is in a model class.
The code segment is as below:

```
$professionals = DB::table('member_professional')
    ->select("member_professional.*",
        DB::raw("(GROUP_CONCAT(DISTINCT photos.picture_path SEPARATOR ',')) as 'photos'"))
    ->join('member','member_professional.member_id_fk','=','member.member_id')
    ->join('photos','photos.member_fk','=','member.member_id')
    ->leftjoin('locations','member.city','=','locations.location_id');

        if ($professionals_type != '') {
                     $professionals = $professionals->where('member_professional.biz_category','=',$professionals_type);
        }

        if ($location != '') {
                     $professionals = $professionals->where('member.city','=',$location);
        }

    $professionals = $professionals->where('member.member_type','=',2); 
    $professionals = $professionals->groupBy('member_professional.member_id_fk')
    ->paginate(20);

```

When I run it on the staging server: <http://dev.interioradditions.pk/allProfessionals> it throws the error:

> 
> SQLSTATE[42000]: Syntax error or access violation: 1055 'interior\_dev\_db.member\_professional.biz\_name' isn't in 
>  GROUP BY (SQL: select `member_professional`.\*, (GROUP\_CONCAT(DISTINCT photos.picture\_path SEPARATOR ',')) as 'photos' 
>  from `member_professional` inner join `member` on `member_professional`.`member_id_fk` = `member`.`member_id` inner join `photos` on `photos`.`member_fk` = `member`.`member_id` 
>  left join `locations` on `member`.`city` = `locations`.`location_id` 
>  where `member`.`member_type` = 2 
>  group by `member_professional`.`member_id_fk` limit 20 offset 0)
> 
> 
> 

Whereas when I extract the built sql query from the above statement and execute through PHPMyAdmin it runs fine and gives the result as expected. Please help on getting what's wrong in the Model query.

Thanks!