Laravel 5.3和PHP 7中的GroupBy无法正常工作

Group by is problematic since I switched to PHP 7 and having aggregate values doesn't apply to the way I want to use it.

I've got a list and sometimes there are repeats in the list. For example:

Song Title A Song Title B Song Title A (reprise) Song Title C

In the results, Song Title A should only show up once. Previously, I had done this with group by, where the ID that determines the song title is grouped.

My table structure is:

id
group_id
song_title_id

Song_title_id relates to:

id
song_title

In the first table, there can be multiple instances of the same song_title_id. And when results are returned, I want there to only one instance of each song_title_id in the results.

Previously, I'd have done:

DB::table('group_songs')
         ->groupBy('song_title_id')
         ->get();

Since updating to PHP 7, I get an error:

Syntax error or access violation: 1055 '[table/column name]' isn't in GROUP BY

What am I doing wrong?

By How to resolve "isn't in GROUP BY" error in mysql query Each non-aggregated field should be grouped, so try

DB::table('group_songs')
         ->groupBy('song_title_id')
         ->groupBy('group_id')
         ->groupBy('id')
          ->get();
'mysql' => [
    'strict' => false,
],