Created
August 29, 2017 09:47
-
-
Save eatgrass/47cf62a61f7746b10fea1c3b8474a52e to your computer and use it in GitHub Desktop.
select with given interval
This file contains 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
-- 1 week ago | |
SELECT * FROM table WHERE inputtime>DATE_SUB(CURDATE(), INTERVAL 1 WEEK) | |
-- 1 year ago | |
select *,YEAR(dateTime) from table where year(dateTime)=year(date_sub(now(),interval 1 year)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment