MySQL select entries older than

From D3xt3r01.tk
Revision as of 21:56, 25 June 2009 by Admin (talk | contribs) (New page: ==Query== <source lang="mysql"> SELECT * FROM `table` WHERE `timestampfield` > subdate(NOW(), INTERVAL 10 MINUTE); OR SELECT * FROM `table` where `timestampfield` > NOW() - INTERVAL 10 M...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Query

SELECT * FROM `table` WHERE `timestampfield` > subdate(NOW(), INTERVAL 10 MINUTE);

OR

SELECT * FROM `table` where `timestampfield` > NOW() - INTERVAL 10 MINUTE;

That would show you all the entries created in the last 10 minutes .. you can replace 'minute' with hour/day/month/year... ofcourse .. you can also replace the number ..

LINKS

MySQL Manual Entry