On Tue, 24 Jul 2001 15:09:14 -0400, [EMAIL PROTECTED]
(Ryan Shrout) wrote:
>I need a MySQL query that will select all the entries in it made within the
>last hour.
>I tried this, but it is not working correctly, what am I doing wrong?
>SELECT *                                                         
>                FROM session
>                WHERE (session.Date > DATE_SUB(NOW(), INTERVAL 1 HOUR))

Now() will return the current time.  by definition, at the time it's
running, there will be zero or almost zero (depends on how 
fast the query runs... someone might insert a row between
when the now() gets executed and when the query ends)
rows.  you are basically asking for rows that were inserted
from now up to one hour in the future.  those rows aren't
there yet.

try testing for less than.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to