Level 61
SQLITE requires group by when using 'having'
Not only SQLite, MySQL does also.
The following query works fine with Mysql:
Community::withCount('stories')->having('stories_count', '>', 20)->whereNotExists(function($query) {
$query->select(DB::raw(1))
->from('communities_followers')
->whereRaw('communities_followers.community_id = communities.id and communities_followers.user_id = '. auth()->id());
})->inRandomOrder()->first();
But my testsuite uses sqlite with an in memory database and fails because the query does not have a group by field. Is there anyway to disable that requirement in SQLITE? If not, what would be the proper group in this statement?
Please or to participate in this conversation.