John Holmes wrote:

From: "Greg Donald" <[EMAIL PROTECTED]>

You can't get the average and a count in the same query


Sure you can.
mysql> select count(number), avg(number) from numbers;


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...

Jay Blanchard's worked perfectly: "SELECT (COUNT(date1)/COUNT(DISTINCT(date1))) AS average FROM $table_name where date1 != '$today'";

I was looking for the average amount of records (submissions) per day.

Thanks.
Jeff

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to