hi, can anyone tell me how to calculate the average of data retrieves from a database. The situation is I have a table "number" which consist of several data like "2,5,4,8,6...." I want to calculate the average and display it on the browser. thanks in advance for your help.
http://www.islandinfo.mu
You can use the AVG aggregate function for that, e.g.,
SELECT AVG(colname) FROM tablename
Just keep in mind that aggregates withtout where clauses scan the whole table, so for big tables it could take a while.