Of course, 0 records are ok. Here is an example of mine :

mysql> select now(), now()-7;

+---------------------+----------------+
| now()               | now()-7        |
+---------------------+----------------+
| 2001-07-23 21:45:53 | 20010723214546 |
+---------------------+----------------+
1 row in set (0.05 sec)

As you can see I subtracted 7 seconds not seven days as you wanted it to 
happen. The resulting relation will never fit any data.


David

At 11:02 23.07.01 -0700, 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
>
>This is my data.
>+---------------+----+------------+
>| Host          | ID | TheDate    |
>+---------------+----+------------+
>| 192.168.0.140 |  1 | 2001-07-23 |
>| 192.168.0.140 |  2 | 2001-07-23 |
>| 192.168.0.140 |  3 | 2001-07-20 |
>| 192.168.0.140 |  4 | 2001-07-21 |
>+---------------+----+------------+
>4 rows in set (0.00 sec)
>
>__________________________________________________
>Do You Yahoo!?
>Make international calls for as low as $.04/minute with Yahoo! Messenger
>http://phonecard.yahoo.com/
>
>---------------------------------------------------------------------
>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


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