This is my first attempt at a JOIN MySQL statement…
I have 2 tables..games and games_ratings
both tables have an id column. the id represents the id of the game. and i only want to get the average of the ints in the rating column where the id in games_ratings is equal to the id from the games table.
SELECT a.id, a.name, AVG(b.rating) AS average FROM games a LEFT JOIN games_ratings b GROUP BY a.id ORDER BY average DESC LIMIT 50;
any ideas?
Try this:
Edit: This is a bit hard without your complete schema, but you can try something like this.