On 23-Jul-2001 Mike Mike wrote:
> Hi Folks,
> I'm trying to create a counter for my website.  I'm
> trying to pull the last 7 days worth of data out of
> mysql.  My sql statement is as follows.
> 
> SELECT TheDate, Count(TheDate) AS CountOfdate
> FROM Counter
> WHERE (((TheDate)<Now()) AND ((TheDate)>=Now()-7))
> GROUP BY TheDate;
> When I do this Sql Commmand it returns 0 records.  
> Can someone help me with this statement.
> Thank you -- Mike
> 

run: 
mysql> select now() -7;

    a couple of times & you'll see why.

use ' ... TheDate >= DATE_SUB(current_date, INTERVAL 7 DAY);

And the  'WHERE (((TheDate)<Now())' is prolly worthless (unless you installed
mod_Star-Trek_time_warp).
 
Regards,
-- 
Don Read                                       [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.
                            (53kr33t w0rdz: sql table query)

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to