I just hacked a quick and dirty solution by inserting the following to dal.py at line 7370:

    def avg(self):
return Expression(self.db, self.db._adapter.AGGREGATE, self, 'AVG', self.type)

Worked fine on my tests with MySQL, using it just like sum, but using avg instead.

    -Jim

On 5/17/2012 1:38 PM, Richard Vézina wrote:
Yeah, that's what I thought just after press send :)

Richard

On Thu, May 17, 2012 at 2:33 PM, Jim Steil <[email protected] <mailto:[email protected]>> wrote:

    I see sum, min, and max aggregates in the book at section 6.24.4,
    but no avg.  But, using sum and count (from 6.21.3) you could get
    there.

       -Jim


    On 5/17/2012 1:25 PM, Richard Vézina wrote:

        Hello,

        How I can make an avg() aggregate with web2py?

        Richard


Reply via email to