mySQL date query

mySQL date query

am 13.04.2010 08:20:15 von ron.piggott

I am trying to write a mySQL query on my "stats" table. I am trying to
determine the number of records (users) during a 7 day period ending
yesterday. I always to keep it current ... Yesterday will keep changing.
In other words I want to know the number of users who accessed the web
site during seven full days.

This is the beginning of the query. The date column is "date".

SELECT count(`visits`) as users FROM `stats` WHERE `date`

Thanks, Ron


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

Re: mySQL date query

am 13.04.2010 08:24:09 von Chaitanya Yanamadala

--00163646d6a25f60ac0484185062
Content-Type: text/plain; charset=UTF-8

what is the format of the date u are storing ?

Chaitanya



On Tue, Apr 13, 2010 at 11:50 AM, Ron Piggott <
ron.piggott@actsministries.org> wrote:

> I am trying to write a mySQL query on my "stats" table. I am trying to
> determine the number of records (users) during a 7 day period ending
> yesterday. I always to keep it current ... Yesterday will keep changing.
> In other words I want to know the number of users who accessed the web
> site during seven full days.
>
> This is the beginning of the query. The date column is "date".
>
> SELECT count(`visits`) as users FROM `stats` WHERE `date`
>
> Thanks, Ron
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--00163646d6a25f60ac0484185062--

Re: mySQL date query

am 13.04.2010 08:25:09 von dmagick

Ron Piggott wrote:
> I am trying to write a mySQL query on my "stats" table. I am trying to
> determine the number of records (users) during a 7 day period ending
> yesterday. I always to keep it current ... Yesterday will keep changing.
> In other words I want to know the number of users who accessed the web
> site during seven full days.
>
> This is the beginning of the query. The date column is "date".
>
> SELECT count(`visits`) as users FROM `stats` WHERE `date`

The mysql manual is a good place to start.

http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functio ns.html#function_date-sub

--
Postgresql & php tutorials
http://www.designmagick.com/


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

Re: mySQL date query

am 13.04.2010 08:31:09 von ron.piggott

It is in a 'date' column type YYYY-MM-DD

> what is the format of the date u are storing ?
>
> Chaitanya
>
>
>
> On Tue, Apr 13, 2010 at 11:50 AM, Ron Piggott <
> ron.piggott@actsministries.org> wrote:
>
>> I am trying to write a mySQL query on my "stats" table. I am trying to
>> determine the number of records (users) during a 7 day period ending
>> yesterday. I always to keep it current ... Yesterday will keep
>> changing.
>> In other words I want to know the number of users who accessed the web
>> site during seven full days.
>>
>> This is the beginning of the query. The date column is "date".
>>
>> SELECT count(`visits`) as users FROM `stats` WHERE `date`
>>
>> Thanks, Ron
>>
>>
>> --
>> PHP Database Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>



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

Re: mySQL date query

am 13.04.2010 08:37:28 von Chaitanya Yanamadala

--0016363b8edc060fcd048418809a
Content-Type: text/plain; charset=UTF-8

try this

SELECT DATE_ADD('2008-01-02', INTERVAL -7 DAY);


Chaitanya




On Tue, Apr 13, 2010 at 12:01 PM, Ron Piggott <
ron.piggott@actsministries.org> wrote:

> It is in a 'date' column type YYYY-MM-DD
>
> > what is the format of the date u are storing ?
> >
> > Chaitanya
> >
> >
> >
> > On Tue, Apr 13, 2010 at 11:50 AM, Ron Piggott <
> > ron.piggott@actsministries.org> wrote:
> >
> >> I am trying to write a mySQL query on my "stats" table. I am trying to
> >> determine the number of records (users) during a 7 day period ending
> >> yesterday. I always to keep it current ... Yesterday will keep
> >> changing.
> >> In other words I want to know the number of users who accessed the web
> >> site during seven full days.
> >>
> >> This is the beginning of the query. The date column is "date".
> >>
> >> SELECT count(`visits`) as users FROM `stats` WHERE `date`
> >>
> >> Thanks, Ron
> >>
> >>
> >> --
> >> PHP Database Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> >
>
>
>

--0016363b8edc060fcd048418809a--