I want it in the order of start date, take the top 10, and then avg those numbers

You need a derived table to do that:

select avg(points)
from (
  select pgs.points
  FROM player_game_stats pgs 
    JOIN games g ON pgs.game_id = g.id 
  where pgs.player_id=265
    and g.part_of_season IN ('REGULAR', 'BUBBLE') 
  order by start_date desc 
  limit 10
) t;

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top