Hi friends,
Can someone tell me that how I can get the average of the numeric fields, and the count of the rows from each column from the database by using the php functions.
mannu
COUNT(PK) AVG(Column)
Also see your TSQL manual for GROUP BY which works good with COUNT and AVG
When using COUNT(field) and AVG(field), remember to use an alias for the output data:
SELECT AVG(field) as myaverage FROM table;
Or you'll have a good time looking for your data in an associative array resultset.
The AVG(), and count() functions are from the sql, but I want the average, and count without using them. Does php has those functions, if so how I can use them. Thank you Anil
a) doing it in php is not smart if you are getting the data from a database. b) it's not a function, it's simple math: average = (total of the items) / (number of items)
Thank you