I need to calculate the average score of every player's 3 most recent scores (golf rounds). If it matters to the code / syntax, this is only required when they have a minimum of 3 scores.
I have a view that has these fields:
round_id
player_id
score
round_date
As new scores are entered into the database, I would like to keep track and notified. I thought my options would to be keep this within the database (somehow) or to generate appropriate php code to do the equivalent. But thought keeping inside the database itself, it could / would handle new data insertions / updates better. PHP would have a page that would need to be loaded to execute.
I have seen some examples of nested select statements, and some that have mysql variables (my basic sql skills, not really gone into variables so would need explaining). none seem to directly relate to my specific needs.
Thanks