Last active
September 2, 2015 17:35
-
-
Save javidjamae/39c1ebcff8e83370dddb to your computer and use it in GitHub Desktop.
Select all records created in the last month (MySQL)
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 records | |
where PERIOD_ADD(DATE_FORMAT(NOW(),'%Y%m'), -1) = DATE_FORMAT(created_at,'%Y%m') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment