Table
+--+------------+ |Id| Date | +--+------------+ |1 | 2017-08-08 | +--+------------+ |2 | 2017-08-23 | +--+------------+ |3 | 2017-08-23 | +--+------------+ |4 | 2017-08-24 | +--+------------+ |5 | 2017-08-24 | +--+------------+ Query
SELECT * FROM BoxExits WHERE Date BETWEEN '2017-08-08' AND '2017-08-24' Problem
When i execute the query i receive the expected dated (from id 1 to 3) except for all rows that contains this date 2017-08-24 (from id 4 to 5) the only way to gather it is by adding one day so that the query looks like this
SELECT * FROM BoxExits WHERE Date BETWEEN '2017-08-08' AND '2017-08-25' In this case is will retrieve all rows that contains this date 2017-08-24 (from id 4 to 5), since the user is the one that will chose the dates i don't want to force him to add one day to the date is looking for.
So how can i do it to the query give me also the max date (2017-08-24)?
My Research
While Searching i didn't find much except for this:
SELECT * FROM BoxExits WHERE Date >= '2017-08-08' AND Date <= '2017-08-24' since the query says Date <= '2017-08-24' 2017-08-24 should be included but the problem maintains.
Environment Test I Tested it in phpmyadmin and a c# program that i am creating and both are giving me the same result (rows from 1 to 3).
Datecolumn?betweenfor matching dates2017-08-24 12:00:00which is greater than2017-08-24 00:00:00which is what the raw date becomes in the comparison.