I am trying to retrieve all records between two dates and the MySQL query is bringing back records with a completely different date.
My Query Is
SELECT datecreated FROM TABLE_COMPLAINTS WHERE datecreated BETWEEN '01/08/2015' AND '24/08/2015'
The result from that query is this:
As you can tell the dates returned are not in the boundary specified in the SQL Query.
My Question is how do I fix this?
Try this
SELECT datecreated FROM TABLE_COMPLAINTS WHERE datecreated BETWEEN
to_date('01/08/2015','MM/DD/YYYY') AND to_date('24/08/2015','MM/DD/YYYY')
Solution 2
SELECT datecreated FROM TABLE_COMPLAINTS WHERE datecreated >='01/08/2015' AND datecreated <= '24/08/2015'
Solution 3
SELECT datecreated FROM TABLE_COMPLAINTS
where
datecreated >='01/08/2015 06:42:10' and datecreated <='24/08/2015 06:42:50';
Forgive me I didn't see that Time part I thought it is a different column. This should work (I messed with time field to see if there is a difference as all your Times are in 12)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments