FuRiOuS1 wrote:
Hi, i need some help with a select statement, i tried many different
MySQL fucntions and looked through the MySQL manual, and it didnt help
me any. What i want to do is select all rows from a table where my
time column(DATETIME) is less then or equal to 5 minutes ago from
now().
# this will get you date_time 5 minutes ago
select DATE_SUB( now(), INTERVAL 5 MINUTE );
You can use <, >, =, >= or <= operators with dates also. So you can
compare the date in your table like this:
select * from table
where datetimefield <= DATE_SUB( now(), INTERVAL 5 MINUTE );
Read this page if you need more info about date and time functions:
http://dev.mysql.com/doc/mysql/en/Da...functions.html