> Any suggestions on how would you get the server to calculate
> and return the average?

Though I believe someone else already answered this, Django 
allows you to fire off live SQL queries, which can do things like

SELECT AVERAGE(column_name1)
FROM tblTable

which will just return the average of the values in column_name1.

Or, if you want summary values base on groups, you can do things like

SELECT column_name1, AVERAGE(column_name2)
FROM tblTable
GROUP BY column_name1

which would return two columns...one for some common aggregate 
value, and one for the average for items having that common 
aggregate value.  E.g.  if your source data looks something like

column_name1  column_name2
John            1
John            2
John            3
Mary            5
Mary            7
Pat             8

The output would be something like

column_name1  column_name2
John           2
Mary           6
Pat            8

(note that only one column_name1 value appears because we're 
grouping on it, and that the value in column_name2 is the average 
of just the values for that person's name).

The result of the first query (that just returns the average) 
would just return (1+2+3+5+7+8)/6

-tkc








--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to