On 21-Jun-01 Sebastiaan J.A. Kamp wrote:
> As I tried to find out how many entries are written to a 'log' table in the
> past 10, 5, 2 and 1 minute(s), I got some odd results. Since I haven't been
> able to find any reason (NOW()-60) should result in something completely
> different from (NOW()-120), could somebody clarify what's going on here?
> 
> 'changed' is a TIMESTAMP(14) field...
> 
> mysql> SELECT COUNT(*) FROM web WHERE changed >= (NOW()-60);
> +----------+
>| COUNT(*) |
> +----------+
>|   363564 |
> +----------+
> 1 row in set (7.00 sec)
> 
> mysql> SELECT COUNT(*) FROM web WHERE changed >= (NOW()-120);
> +----------+
>| COUNT(*) |
> +----------+
>|       38 |
> +----------+
> 1 row in set (8.27 sec)
> 
> mysql> SELECT COUNT(*) FROM web WHERE changed >= NOW()-120;
> +----------+
>| COUNT(*) |
> +----------+
>|       37 |
> +----------+
> 1 row in set (6.40 sec)
> 
> mysql> SELECT COUNT(*) FROM web WHERE changed >= NOW()-60;
> +----------+
>| COUNT(*) |
> +----------+
>|   364119 |
> +----------+
> 1 row in set (7.46 sec)
> 
> Hope someone can shed some light for me ;-)
> 

run 'select NOW() -60'
 a couple of times & become enlightend.


Hint: DATE_SUB(NOW(), INTERVAL 1 MINUTE)

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.

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