Re: SQL for Showing the number of queries served on each day.
| From: | Uzi Klein | Date: | Sat, 01 May 2004 01:24:13 +0000 |
| Subject: | Re: SQL for Showing the number of queries served on each day. | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-34230@lists.php.net to get a copy of this message | ||
"Vern" <vernon@comp-wiz.com> wrote in message
news:20040430235337.86158.qmail@pb1.pair.com...
> I found this code below that allows me to retreive the queries served on
my
> server for each day but can't figure out how to actually display the
> information using echo. Can some one give me an example using the
following
> SQL?
>
> SELECT DATE_FORMAT(ex_date, '%Y %m %d %W'), COUNT(id)
> FROM email
> WHERE ex_date>Now()-INTERVAL 50 DAY
> GROUP BY DATE_FORMAT(ex_date, '%Y %m %d %W')
> ORDER BY DATE_FORMAT(ex_date, '%Y %m %d %W') DESC
>
> Thanks
i'd use :
SELECT DATE_FORMAT(ex_date, '%Y %m %d %W') as mydate, COUNT(id) AS mysum
FROM email
WHERE ex_date>Now()-INTERVAL 50 DAY
GROUP BY mydate
ORDER BY mydate DESC
then you get mydate as the date you need and mysum as the count of id's
regards, U.