I am doing a select query where I select a row to edit and display the values - however, I wish my select value to get the average of the whole column.
The select is as follows:
The column is rating_learner and we are looking for an average of the rating_learner.total column
The join is where the user id matches the lesson creator (q)
avg( if (rating_learner.teacher_user_id=q.user_id,rating_learner.total,null) ) as average_rating
However, when I select where = lesson id and group by lesson id, I can no longer see the full average of the column - only that average of that unique record.
The objective is to see the average of the full column - despite only choosing one record.