I'm not sure if this is possible what I'm trying to achieve. I want to get the avg of averaged columns.
SELECT avg(col1), avg(col2), avg(col3) FROM tbl
My Result should be the avg of all three avg columns, is this possible? Something like this
SELECT avg( col1, col2, col3) FROM tbl
doesn't work at MySQL 5.1
AutoSum lets you find the average in a column or row of numbers where there are no blank cells. Click a cell below the column or to the right of the row of the numbers for which you want to find the average. On the HOME tab, click the arrow next to AutoSum > Average, and then press Enter.
There is a common question that crops up in analytics, which is can you average your averages. The short answer is no, but a longer explanation is probably needed. Whether you have grouped your data by month, or region, or some other facet – each average you see is based on a different number of data points.
For example, 2+4+4+6+6+8 is 30 divided 6 which results in an average of 5. This is the basic syntax for the AVG function: SELECT AVG(column_name) FROM table_name; In this example, we have a table called students , with columns of id , name , date , and scores .
The average of a set of numbers is simply the sum of the numbers divided by the total number of values in the set. For example, suppose we want the average of 24 , 55 , 17 , 87 and 100 . Simply find the sum of the numbers: 24 + 55 + 17 + 87 + 100 = 283 and divide by 5 to get 56.6 .
Did you try:
SELECT avg( col1 + col2 + col3)/3.0 FROM tbl
You must check that there are no nulls in this columns.
SELECT (AVG(col1) * COUNT(col1) +
AVG(col2) * COUNT(col2) +
AVG(col3) * COUNT(col3)) /
(COUNT(col1) + COUNT(col2) + COUNT(col3))
FROM tbl
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With