[snip]
mysql> desc dates;
+--+-+--+-+-+---+
| Field| Type| Null | Key | Default | Extra |
+--+-+--+-+-+---+
| the_date | date| YES | | NULL| |
| number | int(11) | | | 0 | |
+--
From: "Greg Donald" <[EMAIL PROTECTED]>
mysql> select the_date, count(number), avg(number) from dates group by
the_date;
++---+-+
| the_date | count(number) | avg(number) |
++---+-+
| 2004-01-01 | 3 | 2.
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
On Thu, 16 Sep 2004 16:08:45 -0400, John Holmes
<[EMAIL PROTECTED]> wrote:
> 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
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
[snip]
> You can't get the average and a count in the same query
Sure you can.
mysql> select count(number), avg(number) from numbers;
+---+-+
| count(number) | avg(number) |
+---+-+
|18 | 2.3889 |
+---+-+
1 r
On Thu, 16 Sep 2004 15:15:01 -0400, John Holmes
<[EMAIL PROTECTED]> wrote:
> You can't get the average and a count in the same query
Sure you can.
> desc numbers;
++-+--+-+-+---+
| Field | Type| Null | Key | Default | Extra |
++-+--+---
[snip]
I have a database with a date field in this format
20041016
I'd like to count how many records were made on each day (except today)
and average them. Can I do this in one query or will I need to do some
more PHP stuff after I get some results? Thanks.
Bare bones so far:
$sql = "select dat
From: "Jeff Oien" <[EMAIL PROTECTED]>
I have a database with a date field in this format
20041016
I'd like to count how many records were made on each day (except today)
and average them. Can I do this in one query or will I need to do some
more PHP stuff after I get some results? Thanks.
Bare b
nal Message-
> From: Jeff Oien [mailto:[EMAIL PROTECTED]
> Sent: Thursday, September 16, 2004 2:35 PM
> To: PHP
> Subject: [PHP] MySQL query for average records per day
>
>
> I have a database with a date field in this format
> 20041016
> I'd like to count how m
I have a database with a date field in this format
20041016
I'd like to count how many records were made on each day (except today)
and average them. Can I do this in one query or will I need to do some
more PHP stuff after I get some results? Thanks.
Bare bones so far:
$sql = "select date1 from
11 matches
Mail list logo