Created
December 24, 2019 13:22
-
-
Save ValchanOficial/82c4fb2d6e9806a8dfb8c61f2440a6cc to your computer and use it in GitHub Desktop.
Revisions
-
ValchanOficial created this gist
Dec 24, 2019 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ https://stackoverflow.com/a/1888569/11842937 In MySQL: SELECT * FROM mytable WHERE record_date >= NOW() - INTERVAL 1 DAY In SQL Server: SELECT * FROM mytable WHERE record_date >= DATEADD(day, -1, GETDATE()) In Oracle: SELECT * FROM mytable WHERE record_date >= SYSDATE - 1 In PostgreSQL: SELECT * FROM mytable WHERE record_date >= NOW() - '1 day'::INTERVAL In Redshift: SELECT * FROM mytable WHERE record_date >= GETDATE() - '1 day'::INTERVAL In SQLite: SELECT * FROM mytable WHERE record_date >= datetime('now','-1 day') In MS Access: SELECT * FROM mytable WHERE record_date >= (Now - 1)