Created
October 27, 2010 16:35
-
-
Save gavinblair/649402 to your computer and use it in GitHub Desktop.
select rows with timestamp within the last 30 days
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * FROM mytable WHERE timestamp > DATE_SUB(NOW(), INTERVAL 30 day); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From: http://stackoverflow.com/questions/1095831/mysql-get-the-date-n-days-ago-as-a-timestamp/1096061#1096061