List:General Discussion« Previous MessageNext Message »
From:Graeme B. Davis Date:March 16 1999 2:44pm
Subject:Re: Using avg, min, max functions on a non-numeric field.
View as plain text  
Does anyone have any insight on this?  (I tried selecting avg(count(user) but
that didn't work :( )

select user, modified, count(user) as count from db where user='graemed' group
by modified;

+--------+------------+------------+
| count  | user       | modified   |
+--------+------------+------------+
|     20 | graemed    | 1999-02-01 |
|     17 | graemed    | 1999-02-02 |
|      5 | graemed    | 1999-02-03 |
|     24 | graemed    | 1999-02-04 |
etc...

I want to get a AVG/MIN/MAX of the count column over all the rows.

Ideas?

Thanks!

Graeme

-----Original Message-----
From: Graeme B. Davis <GraemeD@stripped>
To: mysql@stripped <mysql@stripped>
Date: Monday, March 15, 1999 9:47 AM
Subject: Using avg, min, max functions on a non-numeric field.


>I have a database such as:
>
>user (char)
>category (char)
>modified (date)
>
>I want to get the average number of entries per day (possibly broken down by
>category, but not necessary) -- how would I do this?
>
>I want this to be done with all users in the db such as
>
>user      average entries      
> min, max
>-------   ---------------  -------------
>johndoe                
> 43          8,93
>
>Any suggestions?
>
>Graeme "SQL bum" D. :)


Thread
Using avg, min, max functions on a non-numeric field.Graeme B. Davis15 Mar
Re: Using avg, min, max functions on a non-numeric field.Graeme B. Davis16 Mar
  • Re: Using avg, min, max functions on a non-numeric field.Colin McKinnon17 Mar
Re: Using avg, min, max functions on a non-numeric field.Graeme B. Davis17 Mar