Below code returns AVG basket size per customer, would like to make another AVG of result received from bellow query.
Is it possible to achive with single query, or i simply have to run another query were i will calculate AVG(previousresult) ?
SELECT
AVG(total_captured)
FROM
tblbodo_sales
GROUP BY
client_id;
Bellow is result of above query
28.35
5.35
5.07
5.66
5.9
By AVG(previusresult) i mean the following:
28.35 5.35 5.07 5.66 5.9/5
CodePudding user response:
Yes in same query it is possible. Can you try the below one?
SELECT AVG(previousresult) FROM (
SELECT
AVG(total_captured) as previousresult
FROM
tblbodo_sales
GROUP BY
client_id)
AS final_avg;