Created
May 8, 2018 20:46
-
-
Save bjpeterdelacruz/1960c5201e564a96b9f0fc0a0421a380 to your computer and use it in GitHub Desktop.
Find data for one day only in MySQL
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
-- Find data for May 8, 2018 only. | |
-- WRONG | |
SELECT * FROM inbox WHERE datetime >= date('2018-05-08') and datetime < date('2018-05-08'); | |
-- Correct | |
SELECT * FROM inbox WHERE datetime >= date('2018-05-08') and datetime < date('2018-05-08') + interval 1 day; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment