Not 100% clear on what you are trying to do but could you not use a countif of the uid combined with average to get what you need? Similar to above but possible to do it all in one step.
@Sam_w started
London Fixed Gear and Single-Speed is a community of predominantly fixed gear and single-speed cyclists in and around London, UK.
This site is supported almost exclusively by donations. Please consider donating a small amount regularly.
Not 100% clear on what you are trying to do but could you not use a countif of the uid combined with average to get what you need? Similar to above but possible to do it all in one step.