select *
FROM player_game_stats pgs INNER JOIN games g ON pgs.game_id = g.id where pgs.player_id=265
and (g.part_of_season='REGULAR' or g.part_of_season='BUBBLE') order by start_date desc limit 10;
gives me 10 rows of the data i want
however
select avg(points)
FROM player_game_stats pgs INNER JOIN games g ON pgs.game_id = g.id where pgs.player_id=265
and (g.part_of_season='REGULAR' or g.part_of_season='BUBBLE') order by start_date desc limit 10;
gives me a sql error of ERROR: column "g.start_date" must appear in the GROUP BY clause or be used in an aggregate function
why is this a problem and how can i solve it?
points
column? – a_horse_with_no_name