Russell Horn wrote:
I have a table containing a timestamp field, `insert_time`
The manual is clear when it comes to selecting records from the past
week or month, I can use:
SELECT COUNT(*) FROM statistics
WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= `insert_time`;
What I am less sure about is how I would select records that had been
inserted to thee table in the previous hour.
I understand the date functions will ignore the hh:mm:ss - will the time
functions ignore the date? Can anyone suggest what function I need for
this select?
Have you tried any of the functions in the manual?
select NOW();
select DATE_SUB(NOW(),INTERVAL 60 MINUTE);
select DATE_SUB(NOW(),INTERVAL 60 MINUTE)+0;
select DATE_SUB(NOW(),INTERVAL 1 HOUR);
select DATE_SUB(NOW(),INTERVAL 60 HOUR)+0;
Thanks,
Russell.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]