Hello, I have this table browser games and has many rows in it games and I also have another table browsergames_rating that has the ratings for the browser games I want to select data from the browsergames table based on the AVG rating from the browsergames_rating.
this is the code am using right now
$topGames = DB::table('browsergames') ->leftjoin('browsergames_rating', 'browsergames.id', 'browsergames_rating.g_id') ->orderByDesc('AVG(browsergames_rating.rating)') ->get(); return $topGames;
and it returns an error for me this is the error
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'AVG(browsergames_rating.rating)' in 'order clause' (SQL: select * frombrowsergames
can you please help me and thanks.