Re: MySQL query for average records per day
| From: | John Holmes | Date: | Thu, 16 Sep 2004 20:08:45 +0000 |
| Subject: | Re: MySQL query for average records per day | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-196907@lists.php.net to get a copy of this message | ||
From: "Greg Donald" <destiney@gmail.com>
Depends how you interpret his request, I guess. I took it as a request for the count of records per day and then the average of those counts. So, if you had D1 D1 D1 D1 D2 D2 D3 The count would be D1 - 4 D2 - 2 D3 - 1 and the average would be (4+2+1)/3 = 2.333. Can you get that in one query? depends what the OP was after, though... ---John Holmes...You can't get the average and a count in the same querySure you can. mysql> select count(number), avg(number) from numbers;